作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在下面粘贴了以下代码。出于某种原因,response.redirect 似乎失败了,它正在用尽我服务器上的 cpu,但什么也没做。 .net 代码可以很好地上传文件,但不会重定向到 asp 页面进行处理。
我知道这绝对是垃圾,为什么你会有 .net 代码重定向到经典的 asp,它是一个遗留应用程序。我曾尝试在重定向的末尾放置 false 或 true 等,因为我读过其他人对此有疑问。太奇怪了,它在我的机器上本地运行,但不会在我的服务器上运行。远程调试时出现以下错误:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
在远程调试并从 try catch 中取出重定向后,我发现重定向正试图到达正确的位置,但在它离开后,重定向似乎丢失了。 (几乎就好像它无法离开 cobra_import 项目)将一个级别备份到 COBRA/pages。为什么是这样?这以前有效!
public void btnUploadTheFile_Click(object Source, EventArgs evArgs)
{
//need to check that the uploaded file is an xls file.
string strFileNameOnServer = "PJI3.txt";
string strBaseLocation = ConfigurationSettings.AppSettings["str_file_location"];
if ("" == strFileNameOnServer)
{
txtOutput.InnerHtml = "Error - a file name must be specified.";
return;
}
if (null != uplTheFile.PostedFile)
{
try
{
uplTheFile.PostedFile.SaveAs(strBaseLocation+strFileNameOnServer);
txtOutput.InnerHtml = "File <b>" + strBaseLocation+strFileNameOnServer+"</b> uploaded successfully";
Response.Redirect ("/COBRA/pages/sap_import_pji3_prc.asp");
}
catch (Exception e)
{
txtOutput.InnerHtml = "Error saving <b>" + strBaseLocation+strFileNameOnServer+"</b><br>"+ e.ToString();
}
}
}
最佳答案
Response.Redirect 在 try...catch block 中工作得不是很顺畅。参见 this question .
关于c# - 重定向到经典 ASP 失败并显示 "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3006898/
我是一名优秀的程序员,十分优秀!