protected void imgbtn_BBDownload_Click(object sender, EventArgs e)
{
Response.ContentType = "application/exe";
Response.AppendHeader("Content-Disposition","attachment; filename=bb.exe");
Response.TransmitFile( Server.MapPath("~/Resources/bb.exe") );
Response.End();
}
I want to download the bb.exe file which is inside a Resource folder. I have a login form in the开发者_如何学编程 same screen, instead of downloading the file, the username password validation is done and the validiation summary username and password is required is shown. what is wrong with the code. Or if these is any easy method to do, pls suggest. thanks
By default all controls on page are validated, since all controls validation group is same (i.e., blank). Add validation group to login / password / submit button controls. It will then validate only when u click login button but not download file click button.
精彩评论