?
Solved

url mappings with or without trailing slash

Posted on 2014-12-19
1
Medium Priority
?
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
Terry Woods earned 2000 total points
ID: 40510374
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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…
Suggested Courses

801 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