Asp.net handler, how to mvc routing without mvc?

I used to create my web applications in asp.net, so there is only one page that has a default.aspx value

http://localhost/mywebapp1/?q=blog/posts/get/42

I parse "q" myself and do all the processing. I do not need all MVC staff. I just want to delete "? Q ="

any idea?

+3
source share
2 answers

You can use ASP.NET routing outside of ASP.NET MVC. This MSDN article explains how.

+3
source

If you are using IIS 7 (Windows 2008 / Vista or higher), you can use the IIS URL rewrite module from http://www.iis.net/download/URLRewrite

web.config, IIS.

, URLS .

mysite.com/shop/package-one mysite.com/shop/default.aspx?package=package-one

<rewrite>
  <rules>
    <rule name="ShopPackages" stopProcessing="true">
      <match url="^shop/(.*)"/>
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
      </conditions>
      <action type="Rewrite" url="/shop/default.aspx?package={R:1}" appendQueryString="false"/>
    </rule>
  </rules>
</rewrite> 
0

Source: https://habr.com/ru/post/1793601/


All Articles