Hi, I am working on a project with ASP .NET 2.0 and some stuff is not working when www is not there in url. How can i set up that it will automatically redirects by appending www in url. Can i do it using web.config Thanks Salil
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %> <% string base=Request.ServerVariables["HTTP_HOST"]; string url=Request.ServerVariables["URL"]; base=base.Replace("www.",""); if(base == Request.ServerVariables["HTTP_HOST"]) Response.Redirect("http://www."+base+url); %> I wrote this code for basic redirect. Do you guys think i can do better? Thanks
lol, www is just a sub-domain. you can have wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww.domain.com if you wanted