Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 02, 2008 10:46 PM by run4it
Oct 02, 2008 07:12 PM|LINK
Hello, I have taken over a site built in asp.net 2.0 and I have been alerted to a bug that I need to fix (this is the first .net website I have managed). We have a page that allows users to submit a form that queries the database and returns results.
The bug: if a user navigates away from that search page, then uses a link on the home page to go to the search page again, the old results are still displaying instead of the form. The form and the results are on the same .aspx page. However there is a
link that is NOT on the home page that goes to the search form and if the user access the form from there, the results do not show. The only thing I can determine that is different about the links (and they are both just plain old html links) is the "depth"
from within the site that they are located. I am wondering if session state is managed differently if the href has to do a folder traversal.
The page with the form is: http://checkoutacollege.com/ReadySetGo/Set/CollegeSearch.aspx
The href that returns to form page from the home page (and results in the bug) is: <a href="/ReadySetGo/Set/CollegeSearch.aspx">
The href that returns to the from page that is not on the home page is: <a href="CollegeSearch.aspx"> .
I would be grateful for any direction someone might steer me in.
Oct 02, 2008 08:28 PM|LINK
From the introduction you gave i can conclude the two below points
1- Either the page is cached
2- Search results are saved in session variable and once posted back it is getting it from the session ( doesnt make big sense)
So try to remove cache of the page by adding the below code at page_load event
Oct 02, 2008 10:46 PM|LINK
I tried your solution but it had no effect. I believe the search results are actually in session variables so I will have to hunt down why they are being cleared one way and not the other.
Later : Haissam , I figured it out. It did have to do with clearing the session variables. I found that they were being reset in the Master.cs file, but the Master.cs file was not being inherited by the index page, thus the variables were not being cleared.
I put a call to the reset method in the Page_Load event for the search page to ensure that they get cleared there. I suppose that is overkill now, but at least it works.