Solved

Refresh problem on using frames in asp.net.

Posted on 2004-10-20
13
170 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yes we are updating the session variable on each page load.
Thanks
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 8

Expert Comment

by:sigmacon
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
yes it does
0
 
LVL 8

Accepted Solution

by:
sigmacon earned 500 total points
Comment Utility
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
Comment Utility
Ok thanks we finally decided not to use frames.
Thanks for your help.
0
 
LVL 8

Expert Comment

by:sigmacon
Comment Utility
Wise decision ;-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEvens challenge 6 63
wordlen challenge 3 46
listing all functions in JavaScript 19 98
Path to Python 9 36
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 about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 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

16 Experts available now in Live!

Get 1:1 Help Now