• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 771
  • Last Modified:

url rewrite in asp.net with regex from: makale/id{0} to: makale.aspx?id={0}

Hi,

I am willing to make a url rewriting but instead of making it in staticly i want to read it from web.config then change the string from

makale/id{0}        to   makale.aspx?id={0}


how can i achieve it , i could not figure out there are samples for doing similar things as below

but i could not figure out the regex equivalent of my strings to write in Lookfor and Sendto parts in my web.config...

could you pls help me on that?

<RewriterConfig>
   <Rules>
      <!-- Rules for Blog Content Displayer -->
      <RewriterRule>
         <LookFor>~/(\d{4})/(\d{2})/(\d{2})\.aspx</LookFor>
         <SendTo>~/ShowBlogContent.aspx?year=$1&amp;month=$2&amp;day=$3</SendTo>
      </RewriterRule>
      <RewriterRule>
         <LookFor>~/(\d{4})/(\d{2})/Default\.aspx</LookFor>
         <SendTo><![CDATA[~/ShowBlogContent.aspx?year=$1&month=$2]]></SendTo>
      </RewriterRule>
      <RewriterRule>
         <LookFor>~/(\d{4})/Default\.aspx</LookFor>
         <SendTo>~/ShowBlogContent.aspx?year=$1</SendTo>
      </RewriterRule>
   </Rules>
</RewriterConfig>

Open in new window

0
nicedone
Asked:
nicedone
1 Solution
 
Kumaraswamy RCommented:
0
 
nicedoneAuthor Commented:
I went through different websites and managed to do url rewriting...
0
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

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now