C# if else statement not working exactly right

Hello, we are working on a web form project where the first page asks the visitor a question. Depending on the radio group selection value, the user should redirect to a page based on their selected value. Below is the code we are using. What seems to happen, is that if you pick "home", it will go to home.aspx correctly, but if you hit your browser back button and then select "church", it will take you to home.aspx incorrectly.

If I open a different web browser (just to use a totally different browser that has no history of this site) and select "church", it will go to church.aspx, but if you hit your browser back button and then select home, it will take you to church.aspx incorrectly.

Does anyone have any advise on how to get this to work well? Thanks in advance, It seems like we are close but missing something simple.


<%
if (AdorRec.FieldValue("landingQ1", null) == "home")
{
uCreateXMCtrls.uCreateXMCommonCSharp.XMP_RedirectCompatibleWithHelicon3("home.aspx");
}
else if (AdorRec.FieldValue("landingQ1", null) == "church")
{
uCreateXMCtrls.uCreateXMCommonCSharp.XMP_RedirectCompatibleWithHelicon3("church.aspx");
}
else
{
uCreateXMCtrls.uCreateXMCommonCSharp.XMP_RedirectCompatibleWithHelicon3("sorrypage.html");
}
%>
Mark BDirector ITAsked:
Who is Participating?
 
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
Hi,

Just check what do you get in AdorRec.FieldValue("landingQ1", null) in both cases.
It seems your related value is not updating/rendering properly.

Thanks
0
 
Mark BDirector ITAuthor Commented:
Thank you for the comment on this, we found that we needed to turn off user caching. Ed added this to code and is working now.
0
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.

All Courses

From novice to tech pro — start learning today.