开发者

Help with file download in asp.net

开发者 https://www.devze.com 2023-04-08 05:27 出处:网络
protected void imgbtn_BBDownload_Click(object sender, EventArgs e) { Response.ContentType = \"application/exe\";
 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消