Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created asp.net application for facebook application.
If domain name is without 'www' then fconnect to login or logout is not working so I want to redirect with 'www' domain name.
If any user type 'mydomain.com' then it should redirect to 'www.mydomain.com'

Is that any setting in web.config file to perform this action?

can anyone know how to do this?

Thanks
Imrankhan
Posted

It's your app, check the URL and add www if necessary or use URLRewrite[^]
 
Share this answer
 
Comments
thatraja 8-Jan-11 2:28am    
Good answer
Check out below artilce
URL Rewriting with ASP.NET



Accept the answer if found useful :)
 
Share this answer
 
Comments
thatraja 8-Jan-11 2:28am    
Good answer
I am using mojoportal framework so I do not use URL rewrite feature as mojoportal use their URL rewrite concept.

Is there any setting in IIS or web.config file to perform this task?

Thanks
Imrnakhan
 
Share this answer
 
In the
<system.webserver></system.webserver>
section of your web.config file add a rewrite rule like this:

XML
<rewrite>
  <rules>
    <rule name="mydomain" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^mydomain.com$" />
      </conditions>
      <action type="Redirect" url="http://www.mydomain.com/{R:0}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900