Refresh problem on using frames in asp.net.

Hi experts I am using a frames page and called 2 pages in a frameset.
The header is index.htm and in the center i have mainpage.aspx.
So my mainpage.aspx is the one from where the user navigates the site.
So if we are in the application and we click on refresh then we are redirected back to
the mainpage.aspx which is called by initial frame.
Any suggestions or help will be appreciated.
Thanks

LorneBacklerAsked:
Who is Participating?
 
sigmaconConnect With a Mentor Commented:
Then I do not have enough information to help you. When you go to another page, lets say 'otherpage.aspx', then you refresh, and you do a view source and it has otherpage.aspx on the src for the frame but shows the mainpage in the frame, then it's not following your frame set definition, and at this point I cannot really see why?
0
 
sigmaconCommented:
Replace index.htm (the file defining the frames) with index.aspx. Create a session variable, e.g. LastPageAccessed, that by default is set to "mainpage.aspx". 'Paint' the frameset in index.aspx, using as source for the center frame the values of the LastPageAccessed session variable. Every time your user requests a new dynamic page in the center frame, set LastPageAccessed to that page's relative file and path name. If the user were to refresh your frameset, it would then be created with the most recent accessed page loaded in the center frame.

If this is not going to work for you, let me know. There are other, more complex solutions that involve more hacking.

Note: I don't mean to be rude, but you should really not use frames. Most web application problems that are attempted to be solved with frames have a simpler solution not involving frames.
0
 
LorneBacklerAuthor Commented:
Thanks for your advice, it is very likely to work.
We would like to know if you know how to assign the src="lastAccessedPage" from code behind or dynamically if we stored the page path in the session variable.
We tried this
<frame name="mainpage" runat="server" id="frmMain" src="<% session("lastAccessedPage") %>" scroll="auto"> etc
The error message we get is "The server tags can not contain <% %>"
So if we try to assign the main.src=session("lastAccessedPage")  'from code behind will this work?
And if so then how can we declare main in the code behind as html frame. For ex: Protected withevents main as ....

Please advise as soon as you can?


0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sigmaconCommented:
You don't need to run this as a server tag, do instead and make sure the page is treated 'old-style' (without using code behind for something as simple as an output):

<frame name="mainpage" id="frmMain" src="<% session("lastAccessedPage") %>" scroll="auto">

Your other idea with code behind might work too, if you fix the name of the object (I think it should be frmMain ? or at least mainpage, but not main) ...

0
 
LorneBacklerAuthor Commented:
Yes we tried this but instead of refreshing the page it reloads it again like it would for the first time.
So is there a work around?
Thanks
0
 
sigmaconCommented:
Well, are you updating the session variable everytime the user goes to a differen page with that page's name?
0
 
LorneBacklerAuthor Commented:
Yes we are updating the session variable on each page load.
Thanks
0
 
sigmaconCommented:
So, when you refresh the page, how does the source-code of the frame look? Does the sourse for the main-page frame actually point to a different file?
0
 
LorneBacklerAuthor Commented:
Yes it is a different page. The page that we want to refresh.
But instead it just reloads it again.
Thanks
0
 
sigmaconCommented:
So you are saying your frame statement send to the browser looks something like this:

<frame name="mainpage" id="frmMain" src="otherpage.aspx" scroll="auto">

but it's loading mainpage.aspx on refresh?
0
 
LorneBacklerAuthor Commented:
yes it does
0
 
LorneBacklerAuthor Commented:
Ok thanks we finally decided not to use frames.
Thanks for your help.
0
 
sigmaconCommented:
Wise decision ;-)
0
All Courses

From novice to tech pro — start learning today.