Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6967351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:18:35+00:00 2026-05-27T16:18:35+00:00

Given a URL rewrite rule like the following: <rule name=RewriteUserFriendlyThings stopProcessing=true> <match url=^cat/sub-cat/(\d+)/([^/]+)/?$ />

  • 0

Given a URL rewrite rule like the following:

 <rule name="RewriteUserFriendlyThings" stopProcessing="true">
        <match url="^cat/sub-cat/(\d+)/([^/]+)/?$" />
        <conditions>
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="cat/sub-cat/detail.aspx?id={R:2}" />
      </rule>

In C# code I need to read out the value in the second group of the pattern (which is my ID) for my Bookmark button (don’t ask) to work with pages that are dynamic like this. I’m using a certain CMS which does things at publish time, and we missed out bookmarking dynamic content.

So what I’ve done is load the web.config as XML and match the current URL based on what is in the url attribute of the match element. However, I can’t figure out how to get at the group. Bearing in mind this needs to be generic so in another rule the group could be the third or first group.

I have a white list of rules which I do this against.

I tried using Capture Groups (?<id>\d+) but the web.config doesn’t allow them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:18:36+00:00Added an answer on May 27, 2026 at 4:18 pm

    The way I’ve got around this is using the Server Variables feature of the IIS 7 URL Rewriting module.

    I defined a new allowed server variable and then captured the value that I needed that way using the IIS URL Rewrite syntax {R:2}. I could then acccess the value using the HttpContext.Request.ServerVariables collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'ld like to analyze the certificate of a given url and get some details
i have a URL which i would like to re-route in the following manner:
I have an issue with my .htacess Rewrite Rules... I have the following rule:
I have an url address like: example.com/?page=3 How can I write the .htaccess rewrite
Given: Url - http://www.contoso.com/search.php?q= {param} returns: -html- --body- {...} ---div id='foo'- ----div id='page1'/- ----div
I want to pop a browser with a given url from within a windows
i am using asynctask to fetch images from given url.these images are displaying in
Given a URL, how can you tell if the referenced file is and html
Given a URL A which gets redirected to a 3rd party website B, in
Given a url to an image is there a way in Django/Python to pull

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.