// Collect url information being requested
string urlHttps = Request.ServerVariables["HTTPS"];
string urlHost = Request.ServerVariables["HTTP_HOST"];
string urlUrl = Request.ServerVariables["URL"];
string urlQueryString = Request.ServerVariables["QUERY_STRING"];
// Check if www appears in the domain and begin building url to redirect to if it doesn’t
if (!urlHost.Contains("www."))
{
string urlNewUrl = "http://www.";
//Add the domain, folder(s) and page requested as well as remove directory indexes
urlNewUrl = urlNewUrl + urlHost + urlUrl;
//If there is a querystring, add it to the redirect link
if (urlQueryString.Length > 0)
urlNewUrl = urlNewUrl + "?" + urlQueryString;
//Do the actual 301 redirect to the newly constructed url
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", urlNewUrl);
Response.End();
}
Friday, December 12, 2008
Building URL with www.
at
3:20 AM
·
Category: Other
Subscribe to:
Post Comments (Atom)
Archivo
-
▼
2008
(20)
-
▼
December
(14)
- Building Custom Control : Tell A Friend Custom Con...
- Watermark on image : Draw string on the image
- Remember me on this computer - Store username and ...
- Building URL with www.
- HIGHLIGHT STRING IN IMAGE [ DRAW STRING WITH HIGHL...
- LOOPING IN STORED PROCEDURE [CURSOR IN SQL SERVER]
- CHANGE IMAGE COLOR USING C# ( GRAPHICS GDI+ )
- DRAW STRING WITH MULTI LINES IN FIX RECTANGLE
- DRAW STRING WITH TWO LINES IN FIX RECTANGLE
- DRAW STRING IN FIX RECTANGLE WITH BACKGROUNG COLOR...
- DRAW STRING IN FIX RECTANGLE WITH BACKGROUNG COLOR...
- DRAW STRING IN FIX RECTANGLE WITH BACKGROUNG COLOR...
- DRAW STRING IN FIX RECTANGLE WITH BACKGROUNG COLOR
- DRAW STRING IN FIX RECTANGLE
-
▼
December
(14)
Categories
- Custom Control (1)
- Data Control (1)
- Graphics GDI+ (11)
- Other (6)
- SQL SERVER (1)
0 comments:
Post a Comment