Solved

URL Rewrite / mapping in asp.net

Posted on 2014-12-16
2
205 Views
Last Modified: 2014-12-19
I use the URL rewrite module in web.config to make canonical URL. That works perfect.

Now I want to make some easy "shortcut" urls that is mapped to the original long url.

Example:

If user writes http://www.example.com/contact/ that url should point to this spesific url (not redirected if possible): http://www.example.com/templates/sections/common/module.aspx?id=5790

I tried this, but no luck:

<rewrite>

  <rewriteMaps>
    <rewriteMap name="Redirects">
      <add key="/contact/" value="/templates/sctions/common/Module.aspx?id=5790" />
    </rewriteMap>
  </rewriteMaps>

  <rules>
    <rule name="CanonicalHostName" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^www\.nettdating\.no$" negate="true" />
      </conditions>
      <action type="Redirect" url="http://www.nettdating.no/{R:1}" />
    </rule>
  </rules>

</rewrite>

Open in new window


How do I make (static) friendly URLs like I try to do here?
0
Comment
Question by:webressurs
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
webressurs earned 0 total points
ID: 40508818
I solved this myselves this way:

<system.web>
    <urlMappings>
      <clear />
      <add url="~/contact" mappedUrl="~//templates/sections/common/module.aspx?id=5790" />
      <add url="~/contact/" mappedUrl="~//templates/sections/common/module.aspx?id=5790" />
    </urlMappings>
</system.web>
0
 
LVL 1

Author Closing Comment

by:webressurs
ID: 40508819
This worked perfect!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now