我需要编程来专门保存动态创建的文件到客户端系统的C:\ Drive。
我尝试了以下代码
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盘