So this url: http://www.mystoreurl.com/PageNotFound. ... t-C23.aspx
Would put the search terms "some product" in the search box. I had it working perfectly until I put in an actual Able URL error (with C23 or P23). I realize that Able is using the URL for the category or product ID and the browser is getting the rewritten URL. Is there anyway I can use C# to get the rewritten - search friendly URL?
I'm using this code in a custom Conlib file based off of the SimpleSearch control.
Code: Select all
protected void Page_Load()
{
// GET ERROR URL
string errURL = AlwaysConvert.ToString(Request.QueryString["aspxerrorpath"]);
// REMOVE FILE EXTENSION AND OTHER UNWANTED CHARACTERS
errURL = Regex.Replace(errURL, @"\.[^.]+$", "").Replace("-", " ").Replace("/", "");
// REMOVE CATEGORY OR PRODUCT ID
// DOESN"T WORK BECAUSE OF URL REWRITE
// string cleanURL = Regex.Replace(errURL, @"([cC][0-9]*|[pP][0-9]*)", "");
// PUT HUMAN SEARCH TERMS IN BOX
SearchPhrase.Text = cleanURL;
}
Thanks for any help,
Dappy