为什么Context.RewritePath方法不适用于iis

时间:2011-12-28 06:40:29

标签: asp.net iis deployment iis-7

我有一个asp.net3.5网站。想在iis上部署这个网站。部署后我的默认页面无法重定向到另一个页面。需要帮助理解为什么页面没有重定向 我的默认页面是

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
        Response.Write("hello")
      Context.RewritePath("~/asp/Default.aspx", False)


    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>

需要帮助为什么Context.RewritePath这个方法不起作用。我的服务器版本是windows server 2008 r2,iis-7.0,网站开发3.5

如果有任何疑问请询问,谢谢先进。

1 个答案:

答案 0 :(得分:0)

这需要在begin_request

下的globals.acsx页面中