Need to force a page reload in ASP.NET OR solve a flash problem

Hi.

I am using Swishmax and have created flash movies for products on my site.

My site is bilingual, so that on each page I have an English and a French version of the flash (2 different movies on the same page). I have put each of the movies in a different <asp:panel>, and I am setting their visibility property to true or false depending if the cookie identifies the user as an english or a french visitor.

The code works fine whenever a visitor comes in from any language.

Now I also have a "Change language" button on my webpage, which changes the person's language preference in their cookies.

Now if I go back to the page with the flash movies (after I changed the language at least one time), it will always show the flash IN THE PERSON'S PREVIOUS LANGUAGE. It just seems to totally ignore the code, and seems to think the flash it has already loaded is just fine.

So I have the wrong language on the screen. But if I push reload on the browser, the page language changes and the page loads the correct flash movie.

Here's my code, where the <asp:panels> are named "air" and "airf":


Sub Page_Load(Source as Object, E as EventArgs)
      
   If Not Request.Cookies ("userprofile") Is Nothing then
          Whichlang = Request.Cookies ("userprofile")("langpref")
   end if

   air.Visible = False
   airf.Visible = False
       
   If Whichlang = "english" then
          air.Visible = True
   else
          airf.Visible = True
   end if

End Sub


Help ! I need to release the site ASAP!


Thanks,

Peter
pbisseggerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pbisseggerAuthor Commented:
OK, did a bit of additional debugging and have some more info:

1. When I get the problem, the entire page (not just the flash movie) is in the wrong language.

2. The problem occurs only when I call the page from another flash movie (not from HTML code on another page). Again though the flash movie just calls a page products.aspx, but it seems like it's calling a CACHED or previous version of that page.

Interesting .....

Thanks,

Peter
0
samtran0331Commented:
one thing you can try is to set the products.aspx page to never cache...
put this in the <head>..

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
0
RejojohnyCommented:
cls u post the code where u store the cookie and also the code for the "Change Language" button .. remember the code for the page load always gets fired first .. so it seems that ur change language code just contains code to change the cookie value .. But the page load is run first and so changing the cookie after that would not affect ur code written in page load ..  ur code should be something like this ..

Sub Page_Load(Source as Object, E as EventArgs)
  if not page.ispostback then
      If Not Request.Cookies ("userprofile") Is Nothing then
          Whichlang = Request.Cookies ("userprofile")("langpref")
      end if
      ChangePanel(Whichlang)
   end if
End Sub

Sub ChangePanel(byval Whichlang as string)

   air.Visible = False
   airf.Visible = False
       
   If Whichlang = "english" then
          air.Visible = True
   else
          airf.Visible = True
   end if

End Sub

Within the ChangeLanguage button
change the value of the cookie and then call ChangePanel passing the new language .. no need to read the cookie again...

Rejo
0
RejojohnyCommented:
as for not caching the page just add this line in page load
Response.Cache.SetCacheability(HttpCacheability.NoCache)

Sub Page_Load(Source as Object, E as EventArgs)
    Response.Cache.SetCacheability(HttpCacheability.NoCache)
    if not page.ispostback then
      If Not Request.Cookies ("userprofile") Is Nothing then
          Whichlang = Request.Cookies ("userprofile")("langpref")
      end if
      ChangePanel(Whichlang)
   end if
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pbisseggerAuthor Commented:
Both ideas sounded really great but unfortunately did not solve my problem. I tried them each on their own, and together, from both the calling page and the destination page.

As requested, please find below my code for the change language button as well as the cookie storage. However, I have checked the cookies and they are working fine. In other words, if I expect an english page the cookie will say english, but the page will display french.

Now, the change language function is in a file called top.ascx, which provides a common top of the page for each of the pages on my site.

Sub Changelanguage(sender As Object, e As CommandEventArgs)

if e.CommandName = "english" then
     aCookie.Values("langpref") = "english"
else
     aCookie.Values("langpref") = "french"
end if
            
aCookie.Expires = DateTime.Now.AddDays(365)
aCookie.Domain = "www.mydomian.ca"
Response.Cookies.Add (aCookie)      

Thisstring = request.servervariables("URL")
Response.Redirect(right(thisstring,len(thisstring)-1))

End Sub

and the HTML is

        <table>
            <tbody>
                <tr>
                    <td>
                        <asp:ImageButton id="btnEnglish" ImageURL="images/English.jpg" height="25" width="103" border="0" onCommand="Changelanguage" CommandName="english" Runat="server" /></td>
                    <td>
                        <asp:ImageButton id="btnFrench" ImageURL="images/French.jpg" height="25" width="108" border="0" onCommand="Changelanguage" CommandName="french" Runat="server" /></td>
                </tr>
            </tbody>
        </table>



Thanks for your help - we'll find the problem yet !

Peter
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.