I have to fetch the domain title and path in the request to supply the next return values:

domain1.com/default.aspx    returns      domain1.com/default.aspx

domain1.com/                returns      domain1.com/

domain1.com                 returns      domain1.com

Right now every URL fetch function I attempt appears to come back domain.com/default.aspx regardless of what the address bar during my browser states. Any means to fix this?

I have attempted many different built-in function to retreive areas of the request but none of them appear to supply preferred results.

There's a strategy to your condition.

HttpContext.Current.Request.Urlwill return a Uri object that consists of all of the areas of the URL divided for you personally. From that, you need to have the ability to get what you are searching for. Particularly, the home you would like is Uri.Authority.

EDIT: Try something similar to this:

    public static string GetPath(this HttpRequest request)

    

You might like to possess a single website within IIS with multiple bindings/host headers for the domain names, and take away default.aspx in the default documents. You should then have the ability to make use of the urlMappings configuration element to facilitate your redirects. If you want a lot of the urlMappings read this link: http://dotnetperls.com/urlmappings-aspnet

You can create an HttpModule for every domain - implement the applying_BeginRequest event like so:

private void Application_BeginRequest(object source, EventArgs e)

items page

        context.Response.Redirect(filePath + "items.aspx")

    



This will redirect http://world wide web.domain1.com/ to http://world wide web.domain1.com/items.aspx - demands for http://world wide web.domain1.com/default.aspx shouldn't redirect.

please provide default document in IIS, and it'll operate in in an identical way as you would like. so that your can set items.aspx in domain1.com's default document as well as in domain2.com allow it to be groups.aspx and it'll be ready.