How can I rewrite an incoming request

Discussion in 'ASP.NET / ASP.NET Core' started by lethers, Feb 5, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. How can I rewrite an incoming request from:

    http://MyDomainName.com

    to:

    http://www.MyDomainName.com


    I'm asking this in response to a WCF service problem where I try to instantiate an object in JavaScript which is defined with a DataContract attribute in my C# server code. When the user enters www.MyDomainName.com there are no problems. But if the user enters MyDomainName.com without 'www' the instantiation fails. The support center at DiscountASP said this is because there can be only one address for a WCF endpoint. There was no further help as to how to solve this issue.

    Thanks for any help or guidance,
    Paul
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    You can try use the IIS rewrite module if you are hosted on IIS 7. I have not tried this on WCF though.. i am not sure if it will work.

    Why can't you tell you user to use http://MyDomainName.com as the host name? If they don't listen and use www.MyDomainName.com as the URL, they deserve to get an error :)

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page