我已经在线学习了一些教程,它们似乎都显示了使用 ASP.net Web 表单的 .net 路由的相同逻辑。当我执行下面的 URL 时,出现 404 错误。Test.aspx 位于此应用程序的根文件夹中。
http://www.mydomain.com/member/abc
这是我的 global.asax 内容:
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>
<script runat="server">
void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute(
"TestABC",
"member/{name}",
"~/Test.aspx");
}
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
</script>
我的 web.config 文件有什么需要做的吗?
任何帮助是极大的赞赏。