Solved

Refresh problem on using frames in asp.net.

Posted on 2004-10-20
13
171 Views
Last Modified: 2010-04-17
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

0
Comment
Question by:LorneBackler
  • 7
  • 6
13 Comments
 
LVL 8

Expert Comment

by:sigmacon
ID: 12366337
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
 

Author Comment

by:LorneBackler
ID: 12381633
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
 
LVL 8

Expert Comment

by:sigmacon
ID: 12382624
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
 

Author Comment

by:LorneBackler
ID: 12386971
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
 
LVL 8

Expert Comment

by:sigmacon
ID: 12387284
Well, are you updating the session variable everytime the user goes to a differen page with that page's name?
0
 

Author Comment

by:LorneBackler
ID: 12390073
Yes we are updating the session variable on each page load.
Thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:sigmacon
ID: 12392116
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
 

Author Comment

by:LorneBackler
ID: 12406834
Yes it is a different page. The page that we want to refresh.
But instead it just reloads it again.
Thanks
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12415058
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
 

Author Comment

by:LorneBackler
ID: 12416986
yes it does
0
 
LVL 8

Accepted Solution

by:
sigmacon earned 500 total points
ID: 12417162
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
 

Author Comment

by:LorneBackler
ID: 12429290
Ok thanks we finally decided not to use frames.
Thanks for your help.
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12429329
Wise decision ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is an explanation of a simple data model to help parse a JSON feed
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now