URL Rewrite / mapping in asp.net

Posted on 2014-12-16
Medium Priority
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.


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:


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

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


Open in new window

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

Accepted Solution

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

      <clear />
      <add url="~/contact" mappedUrl="~//templates/sections/common/module.aspx?id=5790" />
      <add url="~/contact/" mappedUrl="~//templates/sections/common/module.aspx?id=5790" />

Author Closing Comment

ID: 40508819
This worked perfect!

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …

624 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