我在通过以下方式转发 url 时收到错误:
if (!IsPostBack)
{
string req = Request.QueryString["prodID"];
if (req != null)
{
int prodID = int.Parse(Request.QueryString["prodID"]);
koszyk.Dodaj(prodID);
//del prodID from url:
string url = Request.Url.AbsolutePath;
System.Web.HttpContext.Current.RewritePath(url, "", "");
}
}
错误信息:Virtual Path 执行映射到另一个应用程序,这是被禁止的。
完整日志:System.Web.VirtualPath.FailIfNotWithinAppRoot() +3116542 System.Web.HttpContext.RewritePath(VirtualPath filePath, VirtualPath pathInfo, String queryString, Boolean setClientFilePath) +63 System.Web.HttpContext.RewritePath(String filePath, String pathInfo, String queryString) +48 Zakupy.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Informatyk\Pulpit\NAI\Moduł11\Problem1, 2, 3\Zakupy.aspx.cs:30 System.Web.Util。 CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) + 91 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+2207
当我想在购物篮中添加一些东西时会发生这种情况
有任何想法吗?