locked
Is there any way to hide page name in url RRS feed

Answers

All replies

  • User-821857111 posted

    You can use MapPageRoute to change the URL:

    routes.MapPageRoute("SomeEncryptedValue", "~/page1.aspx");
    routes.MapPageRoute("foo", "~/page2.aspx");

    https://www.codeproject.com/Tips/698666/USE-OF-MapPageRoute-Method-IN-ASP-NET-WEBFORM-ROUT

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 19, 2019 6:49 AM
  • User944797201 posted

    I'd also do use the MapPageRoute and I strongly recommend you to have a look at the documentation too.

    Thursday, December 19, 2019 7:49 AM
  • User665608656 posted

    Hi anupalavila,

    If you want to hide or modify the name of the url, you can make the following changes in the webconfig file of your current project:

    <?xml version="1.0"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="default.aspx Redirect" stopProcessing="true">
                        <match url="^(.*\/)*default\.aspx$" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
                        </conditions>
                        <action type="Redirect" url="{R:1}" redirectType="Permanent"/>
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    For more details, you could refer to this link: https://stackoverflow.com/a/21598770

    You can also refer to this article : URL Rewriting in ASP.NET

    Best Regards,

    YongQing.

    Friday, December 20, 2019 9:07 AM