当前上下文中不存在路径 [英] path does not exist in current context

查看:108
本文介绍了当前上下文中不存在路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试添加linkbutton并想下载文件时它会显示错误

code

  protected   void  lnkdownload_Click( object  sender,EventArgs e)
{

Response.Clear();
LinkBut​​ton l1 =(LinkBut​​ton)发送者;
string filenm = l1.CommandArgument;

Response.ContentType = ContentType;
Response.AddHeader( Content-Disposition attachment; filename = \ + Path.GetFileName(filenm)+ \);
Response.Charset = ;
Response.WriteFile(filenm);
Response.End();
}





错误

当前上下文中不存在路径

解决方案

要点击按钮下载文件,请查看我在以下链接上发布的小技巧。



文件下载图像按钮或按钮单击





希望它会有所帮助。 :)

when i try to add linkbutton and want to download file then it shows me error
code

protected void lnkdownload_Click(object sender, EventArgs e)
        {

            Response.Clear();
            LinkButton l1 = (LinkButton)sender;
            string filenm = l1.CommandArgument;

            Response.ContentType = ContentType;
            Response.AddHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(filenm) + "\"");
            Response.Charset = "";
            Response.WriteFile(filenm);
            Response.End();
        }



error
the path does not exist in current context

解决方案

To download a file on button click , Kindly have a look on a little trick posted by me on the following link.

File Download on Image Button or Button Click


hope it will help. :)


这篇关于当前上下文中不存在路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆