PageNotFound.aspx Query String Help
Posted: Wed Oct 13, 2010 8:36 am
I'm building a custom 404 error page but still using the AbleCommerce PageNotFound.aspx. I want to have a search field that gets populated with the terms from the error query string. Since the user is on a 404 Error and not an App Error - I want to keep them there as much as possible (The default Able error pages are pretty bad - no offense).
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.
When using the line to remove C23 or P23 the resulting string was 'ategory'.
Thanks for any help,
Dappy
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