PageNotFound.aspx Query String Help

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
dappy2
Commander (CMDR)
Commander (CMDR)
Posts: 114
Joined: Wed Jan 18, 2006 5:53 pm
Contact:

PageNotFound.aspx Query String Help

Post by dappy2 » 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.

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;
}
When using the line to remove C23 or P23 the resulting string was 'ategory'.

Thanks for any help,
Dappy

User avatar
s_ismail
Commander (CMDR)
Commander (CMDR)
Posts: 162
Joined: Mon Nov 09, 2009 12:20 am
Contact:

Re: PageNotFound.aspx Query String Help

Post by s_ismail » Wed Oct 13, 2010 10:44 am

dappy2 wrote: 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?
You can write custom Url Rewriter. Read this wiki topic http://wiki.ablecommerce.com/index.php/ ... ovider_API.
There a sample project for both C# and VB is also available.

dappy2
Commander (CMDR)
Commander (CMDR)
Posts: 114
Joined: Wed Jan 18, 2006 5:53 pm
Contact:

Re: PageNotFound.aspx Query String Help

Post by dappy2 » Wed Oct 13, 2010 11:51 am

You can write custom Url Rewriter. Read this wiki topic http://wiki.ablecommerce.com/index.php/ ... ovider_API.
There a sample project for both C# and VB is also available.
I definitely want to use Able's URL ReWrite and I don't want to write my own :)

I just want to capture the client URL for this one page - preferably without resorting to Javascript.

Dappy

Post Reply