Solved

url mappings with or without trailing slash

Posted on 2014-12-19
1
186 Views
Last Modified: 2014-12-21
I use UrlMappings in web.config. Now, I must have 2 url entries to make the mapping work with both the trailing backslash and without. Like this:

    <urlMappings>
      <clear />
      <add url="~/app" mappedUrl="~/Templates/Sections/Common/Article.aspx?id=981" />
      <add url="~/app/" mappedUrl="~/Templates/Sections/Common/Article.aspx?id=981" />
    </urlMappings>

Open in new window


Is it possible to make the url (~/app) work with or without trailing slash, in one line of code? Mabye by using wildcard or something for the "~/app" url..?
0
Comment
Question by:webressurs
1 Comment
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
Comment Utility
If it's a regular expression then you would use url="~/app/?"

However, I found this, which says to me it's not the default behaviour to allow regex's (the article says how to add support for regex's):
http://pietschsoft.com/post/2005/11/12/ASPNET-20-URL-Mapping-with-RegEx-Support
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

728 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

14 Experts available now in Live!

Get 1:1 Help Now