Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net aspx的IIS URL重写模块规则_Asp.net_Iis_Url Rewriting_Url Rewrite Module - Fatal编程技术网

Asp.net aspx的IIS URL重写模块规则

Asp.net aspx的IIS URL重写模块规则,asp.net,iis,url-rewriting,url-rewrite-module,Asp.net,Iis,Url Rewriting,Url Rewrite Module,我的问题很简单,可能有人会问, 我有一个网站www.alovine.com 并且有一个url www.alovine.com/registration.aspx。 现在,我希望人们能够在键入www.alovine.com/registration时打开页面 i、 e.最后没有.aspx 我已经找过了,但找不到答案。 我已尝试使用以下方法在webconfig中进行更改: <rule name="Rewrite ASPX"> <match url="registration

我的问题很简单,可能有人会问, 我有一个网站www.alovine.com 并且有一个url www.alovine.com/registration.aspx。 现在,我希望人们能够在键入www.alovine.com/registration时打开页面 i、 e.最后没有.aspx

我已经找过了,但找不到答案。 我已尝试使用以下方法在webconfig中进行更改:

<rule name="Rewrite ASPX">
    <match url="registration" />
    <action type="Rewrite" url="registration.aspx" />
  </rule>

在Global.asax上插入以下代码:

routes.MapPageRoute("", "{registration}", "~/registration.aspx");
使用上述代码,您的链接将如下所示:

http://localhost:12345/alovine/registration

希望这有帮助

在这里,我不确定这是如何做到的,我使用的是visual studio 2013 btwI,看到您使用的是IIS URL重写规则。也许你可以问一下这个问题。否则,这是一个问题,不是一个问题。感谢您的快速回复,但应该将global.asax文件放在哪里??在application.start中,它指出错误3“routes”名称在当前上下文C:\Users\Ajitesh\Desktop\Web\Vine\WebSite3\Global中不存在。asax 8 9 WebSite3您需要实例化RouteCollection以使用routes变量,这里有一个很好的主题:,别忘了在using语句中包含Web.Http和Web.Routing Shey felix感谢您的帮助,但他不理解这个方法,他说他用Page.RouteData.Values[combinedPin]解决了这个问题,但我如何在我的上下文中使用它呢