2021年5月7日星期五

Writing Asp.net web forms Application URL Like Asp.net MVC (that uses Razor ) URL

Greeting, pardon my maybe non important question, I am just trying to redecorate URLS that I am using in my Asp.net Web Forms application to be like Asp.net MVC apps that uses razor , the first step I've done is to remove the aspx successor and I am done with this but the second step is which I am trying is to replace pagename?id=someid with pagename/id or any formula except the usual formula , tbh the task eventually is to reduce the characters used in the ULR so removing .aspx will execlude 4 characters and the second approach will replace ?id= with slash and renaming page with pagename+id like n1 will not hit the server as the page name would have been changed any suggestion is welcome! I did the bello change on my web.config to exclude aspx successor

<system.webServer>          <rewrite>              <rules>                  <rule name="RewriteASPX">                      <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>              </rules>          </rewrite>      </system.webServer>  
https://stackoverflow.com/questions/67443297/writing-asp-net-web-forms-application-url-like-asp-net-mvc-that-uses-razor-ur May 08, 2021 at 09:30AM

没有评论:

发表评论