Simple URLs and Azure redirect
(Created page with "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 unful example. In this example if the user goes to...")
 
No edit summary
Line 7: Line 7:
and add additional parameters, in this case a search string.
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".
<nowiki>https://app.world.se/su?vSeekParam=bio</nowiki>
But the end user will never see "DisplayWithVariables...", because [[DisplayWithVariables]] is a way to insert parameters in a viewmodel and then open the view normally.
But the end user will never see "DisplayWithVariables...", because [[DisplayWithVariables]] is a way to insert parameters in a viewmodel and then open the view normally.


Open the web.config in the root folder of your site and insert the rewrite code below the applicationInitialization, see below;
==== Adding to your site ====
  ''<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="true" remapManagedRequestsTo="Startup.htm">
Open the '''Web.config''' in the '''wwwroot''' folder of your site and insert the rewrite code below the applicationInitialization, see below;
  ''<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="true" remapManagedRequestsTo="Startup.htm">''
   <add initializationPage="Turnkey/Index" />
   <add initializationPage="Turnkey/Index" />
  </applicationInitialization>''
  </applicationInitialization>
   
   
  ''Insert the code below the applicationInitialization section above.''
  ''Insert the code below the applicationInitialization section above.''

Revision as of 20:23, 8 March 2020

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 unful example.

In this example if the user goes to

https://app.world.se/su

This will be redirected to

https://app.world.se/Turnkey/DisplayWithVariables?view=PublicSeeker&amp;id=22!1212&amp;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".

https://app.world.se/su?vSeekParam=bio

But the end user will never see "DisplayWithVariables...", because DisplayWithVariables is a way to insert parameters in a viewmodel and then 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;

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

Insert the code below the applicationInitialization section above.

  <rewrite>
    <rules>
      <rule name="Redirect subdir" stopProcessing="true">
        <match url="su" />
        <action type="Redirect" url="https://app.world.se/Turnkey/DisplayWithVariables?view=PublicSeeker&amp;id=22!1212&amp;vSeekNow=true" appendQueryString="true" redirectType="Found" />
      </rule>
    </rules>
  </rewrite>

</system.webServer>
And before the end of the system webserver section.
This page was edited 45 days ago on 04/03/2024. What links here