• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 764
  • 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

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

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