- .ini (1)
- Ajax (8)
- Android (27)
- ASP.NET (118)
- ASP.NET errors (5)
- C# (12)
- connection string (2)
- CSS (4)
- Drupal 7 (2)
- E-Books (1)
- Error (3)
- Folder (1)
- General (22)
- google (1)
- Interview questions (5)
- LINQ (2)
- Log file (1)
- Loop (1)
- MachineLearning (3)
- news (3)
- PayPal (4)
- Read (1)
- Regex (3)
- Search a Items in Array() (1)
- SQL (10)
- Technology (5)
- vb.net (33)
- Write (1)
- XML (4)
Search This Dotnetcode
Powered by Blogger.
Categories
welcome Netizen
Share Your Knowledge.It is a way to achieve immortality
Gadget
Powered by Helplogger
Feedjit
Followers
Hi
you have to update to this setting in web.config file........
you have to update to this setting in web.config file........
public class SeoUrls : IHttpModule
{
#region IHttpModule Members
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += OnPreRequestHandlerExecute;
}
public void Dispose()
{
}
#endregion
private void OnPreRequestHandlerExecute(object sender, EventArgs e)
{
HttpContext ctx = ((HttpApplication) sender).Context;
IHttpHandler handler = ctx.Handler;
// Only worry about redirecting pages at this point
// static files might be coming from a different domain
if (handler is Page)
{
if (Ctx.Request.Url.Host != WebConfigurationManager.AppSettings["FullHost"])
{
UriBuilder uri = new UriBuilder(ctx.Request.Url);
uri.Host = WebConfigurationManager.AppSettings["FullHost"];
// Perform a permanent redirect - I've generally implemented this as an
// extension method so I can use Response.PermanentRedirect(uri)
// but expanded here for obviousness:
response.AddHeader("Location", uri);
response.StatusCode = 301;
response.StatusDescription = "Moved Permanently";
response.End();
}
}
}
}
Then register the class in your web.config:
<httpModules>
[...]
<add type="[Namespace.]SeoUrls, [AssemblyName], [Version=x.x.x.x, Culture=neutral, PublicKeyToken=933d439bb833333a]" name="SeoUrls"/>
</httpModules>
Subscribe to:
Posts (Atom)