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 8767391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:47:57+00:00 2026-06-13T16:47:57+00:00

i have an asp.net website where i need to use URL re-write so i

  • 0

i have an asp.net website where i need to use URL re-write so i have written an HTTP module and i have implemented it and it works correctly the only problem is when the page redirect to its corresponding address the images and the styles are not loaded.

here is the http module:

// Your BeginRequest event handler.

private void Application_BeginRequest(Object source, EventArgs e)
{
    HttpApplication application = (HttpApplication)source;
    string URL = application.Request.Url.ToString();
    //int pid = Convert.ToInt32(application.Request.QueryString["pid"]);

    if ((URL.ToLower().Contains(".aspx"))
        || (URL.ToLower().Contains(".js"))
        || (URL.ToLower().Contains(".css"))
        || (URL.ToLower().Contains(".gif"))
        || (URL.ToLower().Contains(".png"))
        || (URL.ToLower().Contains(".jpeg"))
        || (URL.ToLower().Contains(".jpe"))
        || (URL.ToLower().Contains(".jpg"))
        || (URL.ToLower().Contains(".ashx")))
        return;
    else
    {
        string mname = URL.Substring(URL.LastIndexOf("/") + 1).ToString();

        Merchand ms = merchantDB.GetMerchant(mname);

        HttpContext context = application.Context;
        if (ms != null)
        {

            string url = "~/pages/Merchant.aspx?mid=" + ms.MerchandID + "&catid=" + ms.MainCategory + "&subcatid=0";
            context.RewritePath(VirtualPathUtility.ToAppRelative(url));
        }
        else
        {
            //("");
            string url = "~/pages/default.aspx";
            context.RewritePath(VirtualPathUtility.ToAppRelative(url));
        }
    }

}

when i open the page from it normal URL it opens fine, but when i use the url rewrite it open but with out images or styles.

when i open firebug i get an error that the css and the javascript are not found

  • 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-06-13T16:47:58+00:00Added an answer on June 13, 2026 at 4:47 pm

    To make rewrite work with IIS, do the following:

    1. Register the httpmodule in web.config in the system.webserver tag:
    <modules>
    <add name="Rewrite" type="Rewrite"/>
    </modules>
    
    1. change this: context.RewritePath(VirtualPathUtility.ToAppRelative(url)); to this: context.RewritePath(url, false);
    2. make your images runat server and put their path as ~/images/imagename
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an ASP.NET MVC 2 website, and now need to deploy it
I need to use jquery tabs in my asp.net website with ajax mode to
I use ASP.NET website on IIS7 where in web.config I have: <sessionState mode=InProc timeout=20></sessionState>
I have an asp.net mvc3 website, I need to update the database periodically, for
We have an ASP.NET website that we use internally to do some project tracking
I have asp.net mvc website and in some pages i need a paging feature,
I have Asp.net website for domain A users with the Integrated Windows Authentication. Now
We have a ASP.NET website project. In the past, we had been using asmx
I have a asp.net website with a logo. When I go on facebook or
I have a ASP.NET website deployed to IIS with a couple of ashx that

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.