Simple URLs and Azure redirect

If you want to provide an easy-to-type URL for a specific use case hosting your site on Azure or on a local IIS, this is a useful example.

In this example, if the user goes to

This will be redirected to:!1212&vSeekNow=true

and add additional parameters. In this case, a search string.

This URL would open the search page and automatically set the search string to "bio".

But the end user will never see "DisplayWithVariables..." because DisplayWithVariables is a way to insert parameters in a ViewModel and open the view normally.

Adding to Your Site

Open the Web.config in the wwwroot folder of your site and insert the rewrite code below the applicationInitialization - see below:

(to have the same effect with a startup page showing while loading in Turnkey for .netCore see this article StartupViewTemplate)

<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="true" remapManagedRequestsTo="Startup.htm">
  <add initializationPage="Turnkey/Index" />

Insert the code below the applicationInitialization section above.

      <rule name="Redirect subdir" stopProcessing="true">
        <match url="su" />
        <action type="Redirect" url=";id=22!1212&amp;vSeekNow=true" appendQueryString="true" redirectType="Found" />

And before the end of the system webserver section.
This page was edited 29 days ago on 06/17/2024. What links here