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

  • Home
  • SEARCH
  • 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 6617967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:46:02+00:00 2026-05-25T20:46:02+00:00

I have an ASP.NET 4 HttpModule (see code below). When the url path starts

  • 0

I have an ASP.NET 4 HttpModule (see code below). When the url path starts with “/1.0” I want Cassini/IIS to go to MyService.svc. However, I don’t want to show “MyService.svc” to the user (i.e. no update to the url in the browser). I want the user to see “www.something.com/1.0”.

I was pretty sure that RewriteUrl isn’t supposed to change the browser url, but in my case it does. Any idea why?

    public void Init(HttpApplication context)
    {
        context.BeginRequest +=
            delegate
            {
                HttpContext ctx = HttpContext.Current;
                const string BasePath = "~/1.0";
                if (path.StartsWith(BasePath, StringComparison.OrdinalIgnoreCase))
                {
                    ctx.RewritePath("~/MyService.svc", "this/is/a/path", string.Empty, false);
                }
            };
    }

P.S. I cannot use ASP.NET Routing because of the period/dot in the Url (see ASP.NET MVC Route IDs with a period).

  • 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-25T20:46:03+00:00Added an answer on May 25, 2026 at 8:46 pm

    You need url routing of ASP.NET, and it’s available since .NET 3.5 SP1.

    For your case, I think it’s easier to “route” instead of rewriting, and it’s simpler to use.

    Why? MSDN said this:

    In ASP.NET routing, you define URL patterns that contain placeholders
    for values that are used when you handle URL requests. At run time,
    the pieces of the URL that follow the application name are parsed into
    discrete values, based on a URL pattern that you have defined. For
    example, in the request for
    http://server/application/Products/show/beverages, the routing parser
    can pass the values Products, show, and beverages to a handler for the
    request. In contrast, in a request that is not managed by URL routing,
    the /Products/show/beverages fragment would be interpreted as the path
    of a file in the application.

    You can also use the URL patterns to programmatically create URLs that
    correspond to the routes. This enables you to centralize the logic for
    creating hyperlinks in your ASP.NET application.

    ASP.NET Routing versus URL Rewriting

    ASP.NET routing differs from other URL rewriting schemes. URL
    rewriting processes incoming requests by actually changing the URL
    before it sends the request to the Web page. For example, an
    application that uses URL rewriting might change a URL from
    /Products/Widgets/ to /Products.aspx?id=4. Also, URL rewriting
    typically does not have an API for creating URLs that are based on
    your patterns. In URL rewriting, if you change a URL pattern, you must
    manually update all hyperlinks that contain the original URL.

    With ASP.NET routing, the URL is not changed when an incoming request
    is handled, because routing can extract values from the URL. When you
    have to create a URL, you pass parameter values into a method that
    generates the URL for you. To change the URL pattern, you change it in
    one location, and all the links that you create in the application
    that are based on that pattern will automatically use the new pattern.

    See ASP.NET Routing in MSDN Library.

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

Sidebar

Related Questions

I have a HttpModule that redirects certain URL:s in an ASP.NET WebForms application. It
I have an ASP.NET HttpModule that handles HttpApplication.BeginRequest to redirect some requests to other
I have ASP.NET web pages for which I want to build automated tests (using
I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
I have ASP.Net code generating my button's HTML for me using divs to get
I have implemented a HttpModule in ASP.NET (framework 2.0). From my logging on the
I have written an ASP.NET HttpModule and I have a static helper class that
I have an HTTPModule running in IIS 7 providing a number of different URL
I have an HttpModule which is used to dynamically compress content from an ASP.NET
In our asp.net 2.0 application we have the an HttpModule and HttpHandler. They are

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.