Solved

URL Rewrite / mapping in asp.net

Posted on 2014-12-16
2
209 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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