I was working on porting an old page we have, but never quite got around to finishing it entirely, but several days of work had gone into the porting effort. I didn’t want to lose all my hard work so I figured I would check it in, but I also didn’t want people to try and use it before it was truely ready. If you ever experience a similar situation, this code may be of some use, while still retaining some good SEO.
protected override void OnInit(EventArgs e) { bool useNewSignup = Config.Default.GetConfigBool("signup", "useNew", false); if (!useNewSignup) { string absPath = Request.Url.AbsolutePath; string queryString = Request.QueryString.ToString().Length > 0 ? Request.QueryString.ToString() : String.Empty; if (!String.IsNullOrEmpty(queryString)) { newUrl += "?" + queryString;Response.Status = "301 Moved Permanently"; } string newUrl = "/signup.asp" + absPath; Response.AddHeader("Location", newUrl); } base.OnInit(e); }
Site content and design copyright 2005-2010 bsd.bz