tags:

views:

61

answers:

1

Hi. I have a flash image slider with a button below each image. When i press that button, the user is redirected to a new page where i add that image product to my cart.

The problem is that after doing the adding, i want to redirect the user back to the initial page.

The code:

protected void Page_Load(object sender, EventArgs e)
{
    addProductToBasket(getCategoryIdFromUrl(), getProductIdFromUrl());
    Response.Redirect(Request.UrlReferrer.ToString());
}

Please note that in Firefox is working fine but in IE or Chrome it is DOWNLOADING the swf...If i comment Response.Redict(...) the user remains on this page so the click button is working well, only the redirect seems to be the problem.

Any suggestions please?

Edit: The problem seems to be that Request.UrlReferrer keeps as link not the initial page containing the swf but the swf itself....

So, instead of doing redirect to:

http://localhost:1336/Site/Index.aspx

if does redirect to the swf contained on the Index.aspx page

http://localhost:1336/carousel/carouse.swf

Solved: with a session variable where i keep the initial page's url

A: 

It seems to me that it's a function of the flash player setting the referrer header differently in different browsers.

If that is the case, then you might want to have the flash player get the url of the page it is hosted on, and pass that as a parameter to your page, and then redirect to the contents of the parameter.

What I think you really should be doing though is registering an HttpHandler (IHttpHandler implementation) for the URL which performs the processing and creating a response which returns JSON or XML, which flash can easily parse.

This way, you don't have a page reload and you have a seamless experience.

casperOne