C# 响应。重定向继续转到旧URL

C# 响应。重定向继续转到旧URL,c#,asp.net,response.redirect,C#,Asp.net,Response.redirect,我正在使用其他人编写的现有ASP.net C#webapp,我们必须更改主文件的位置。这是一个地址库,当他们点击一个名字时,它会把他们带到一个个人资料页面 配置文件页面位置未更改,但旧的response.redirect是使用虚拟路径写入的。 当我将虚拟路径更改为绝对路径时,webapp不确认更改,并继续重定向到旧路径,导致404错误 以下是.aspx中的LinkButton代码 <ItemTemplate> <asp:L

我正在使用其他人编写的现有ASP.net C#webapp,我们必须更改主文件的位置。这是一个地址库,当他们点击一个名字时,它会把他们带到一个个人资料页面

配置文件页面位置未更改,但旧的response.redirect是使用虚拟路径写入的。 当我将虚拟路径更改为绝对路径时,webapp不确认更改,并继续重定向到旧路径,导致404错误

以下是.aspx中的LinkButton代码

<ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" CommandName="viewProfile" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"  runat="server"><%# (Eval("EmpName"))%> </asp:LinkButton>
                        </ItemTemplate>
这是我把它改成的,但没有改变

 protected void gvFinder_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "viewProfile")
            {
                int index = Convert.ToInt32(e.CommandArgument);
                Session["EmployeeId"] = gvFinder.DataKeys[index].Value.ToString();

                string name = gvFinder.Rows[index].Cells[0].Text;

                string y = gvFinder.DataSourceID;

                Response.Redirect("http://www.ourwebsite.com/Profile");
            }
        }
是否有人熟悉如何将其实际转到旧URL?

有多种选择 1.不可用、脱机或过期
2.如果您有源代码,为什么不将profile.aspx放在项目根目录中呢?如果您想保存旧文件,可以将其重命名为porfileold.aspx。在这种情况下,您不需要更改url,只需重新部署即可正常工作

您是否检查了其中是否涉及一些http处理程序,可能是他们正在重定向到旧路径。唯一的http处理程序是在启动应用程序时由IIS自动生成的。可以安全地假设
http://www.ourwebsite.com
与您从中调用此消息的网站不同吗?否则路径(配置文件部分)会让您回到开始的位置。请尝试“~/Profile”o.。/Profile”我建议您使用Fiddler检查正在发出的请求和响应。你也许能嗅出头上有只老鼠。
 protected void gvFinder_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "viewProfile")
            {
                int index = Convert.ToInt32(e.CommandArgument);
                Session["EmployeeId"] = gvFinder.DataKeys[index].Value.ToString();

                string name = gvFinder.Rows[index].Cells[0].Text;

                string y = gvFinder.DataSourceID;

                Response.Redirect("http://www.ourwebsite.com/Profile");
            }
        }