How to hide asp url in url bar?

2019-09-01 06:01发布

How to hide aspx extension in asp.net project?

Ex -

http://mcs.com/Profile.aspx
http://mcs.com/Profile
or
http://mcs.com/

标签: asp.net url hide
3条回答
淡お忘
2楼-- · 2019-09-01 06:47

quick search pulled up a rule you can run

   <rule name="">
      <!--Removes the .aspx extension for all pages.-->
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="{R:1}.aspx" />
    </rule> 
查看更多
老娘就宠你
3楼-- · 2019-09-01 06:54

If you are using ASP.NET 4, you can use URL Routing (not rewriting). you can see this post: http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx

查看更多
beautiful°
4楼-- · 2019-09-01 07:00

you need to use URL-Rewriting for this...

URL Rewriting in ASP.NET

查看更多
登录 后发表回答