使用 IIS7 的 ASP.net 3 Web 表单中的 URL 路由
我正在使用 Web 窗体 ASP.Net Framework 3.5 我已经建立了一个在 IIS6 上运行良好的网站。我已经为其添加了运行良好的路线。它要求我在 Web.Config 中进行一些更改,并在下面的 global.asax 中添加一些代码
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.Add("Login", new Route("User/Login", new RoutingHandler("~/pages/Users/Login.aspx")));
routes.Add("Products", new Route("Pages/Products/{Category}", new RoutingHandler("~/Products/Default.aspx")));
}
,当我访问 /user/login 或 /products/mobile 等时,它工作正常,
但这在 IIS7.5 上不起作用。当我访问任何路由时,它只会给出 404 错误。如何解决这个问题?我需要进行任何更改才能在 IIS7.5 中运行它吗?
I am using Web Forms ASP.Net Framework 3.5
I have built a website which is running fine on IIS6. I have added routes for it which are running fine aswell. It required me to do some changes in Web.Config and add some code in global.asax which is below
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.Add("Login", new Route("User/Login", new RoutingHandler("~/pages/Users/Login.aspx")));
routes.Add("Products", new Route("Pages/Products/{Category}", new RoutingHandler("~/Products/Default.aspx")));
}
And its working fine when I access /user/login OR /products/mobile etc
But This doesn't work on IIS7.5. There it simply gives 404 error when I access any route. How to fix this? Do I need to make any changes to run it in IIS7.5?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论