0

I have just made a step back from ASP .NET MVC application and moved to ASP .NET Web Forms and I'm wondering is it possible to rewrite url in Web Forms as well. I have a following set of URLs to reqrite:

  • Edit.aspx?type=grbat
  • Edit.aspx?type=lrbat
  • Edit.aspx?type=glsi
  • Edit.aspx?type=llsi

As you can see, everything works on one page.

However, I would like to make URLs more user friendly and replace it with:

  • EditGlobalTopic.aspx
  • EditLocalTopic.aspx
  • EditGlobalInitiative.aspx
  • EditLocalInitiative.aspx

is it possible in ASP .NET Web Forms?

Thanks

2

3 Answers 3

3

You could use an open source component: URL Rewriter.

I've used this is in the past and was able to create friendly URL's quickly.

Sign up to request clarification or add additional context in comments.

Comments

1

I think you'll need url rewriting here (isapi or another similar tool) to achieve what you want.

Here you're accessing to 4 different pages, and they need to be created, or the server will respond with a 404

You could create these 4 pages and then redirect to edit.aspx with proper parameters, but still I think it's a better aproach to use url rewriting (as that's its purpose)

Comments

0

Hello You Can easily rewrite URL from Web.config using Bellow Method ,

    <system.webServer> 
     <rewrite> 
       <rules> 
         <rule name="default">
           <match url="^EditGlobalTopic.aspx" />
             <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_FILENAME}" pattern="\.axd" negate="true" />
               </conditions>
          <action type="Rewrite" url="Edit.aspx?type=grbat" />
            </rule>
       </rules>
   </rewrite>
 </system.webServer>

use

     <a href="EditGlobalTopic.aspx">Go</a>

It will redirect you on that page.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.