Created
March 13, 2014 08:16
-
-
Save netsi1964/9524154 to your computer and use it in GitHub Desktop.
Dynamicweb Razor redirect if missing PID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code snippet for request missing PID - say coming from Google search | |
@using System.Web | |
@using Dynamicweb.Frontend; | |
var request = HttpContext.Current.Request; | |
var response = HttpContext.Current.Response; | |
var pidFromRequest = Dynamicweb.Base.ChkString(request["pid"]); | |
var pageviewURL = GetGlobalValue("Global:Pageview.Url"); | |
if (pidFromRequest=="") { | |
pageviewURL+= (pageviewURL.IndexOf("?")==-1) ? "?" : "&"; | |
pageviewURL+="pid="+PID.ToString(); | |
response.RedirectPermanent(pageviewURL, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment