我需要编程来专门将动态创建的文件保存到客户端系统的C:\驱动器中。
我尝试了以下代码
context.Response.ContentType = "text/plain";
context.Response.AppendHeader("Content-Disposition", "attachment; filename= "TextExport");
string path=@"C:\TestFolder";
Response.TransmitFile(path);
try
{
context.Response.End();
}
catch (Exception ex)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ExMessage", "alert('" + ex.ToString() + "')", true);
}
finally
{
this.Dispose();
}调试时,我收到异常,声明访问被拒绝。
我该怎么办?我特别想保存到C盘
发布于 2019-04-03 18:39:30
如果您使用的是visual studio (管理执行),请检查您是否处于管理模式;如果您使用的是IIS,请检查您的应用程序池是否可以写入您的目录( C:\ )。


https://stackoverflow.com/questions/55492835
复制相似问题