Hello,
We already have a site deployed with a file called global.asax, and I would like to configure it to rewrite the domain on all pages when the user types in http://domain.com to http://www.domain.com. I tried inserting the following code into to global.asax file, but a Runtime Error occurs every time. I am very new to aspx code so please don't assume anything. Here is the complete code inside the global.asax file:
<%@ Application Inherits="HvUser.Global" Language="C#" %>
<script language="C#" runat=server>
void Application_BeginRequest(object sender, EventArgs e)
{
if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://domain.com"))
{
HttpContext.Current.Response.Status = "301 Moved Permanently"; HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://domain.com", "http://www.dom ...
Go to the complete details ...