Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have applied to the directory structure as follows:
[IMG]http://i971.photobucket.com/albums/ae198/haocaocu/Errors/struct_application_zpsrr9ja26q.png[/IMG]
Page iDOC.master I use iframe
<iframe id="ifrmContent" frameborder="0" name="ifrmContent" width="100%" src="Template/Default.aspx"
                                    scrolling="auto"></iframe>
                                <script language="javascript" type="text/javascript">
                                    var frame = document.getElementById('ifrmContent');
                                    frame.height = screen.height - 130;
                                </script>

When I visit a page but every session I checked as follows:
if (Session["UserName"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        else 

but it appears as shown:
[IMG]http://i971.photobucket.com/albums/ae198/haocaocu/Errors/session_expire_zpsw5652yoy.png[/IMG]
if I log in from this, it appears:
[IMG]http://i971.photobucket.com/albums/ae198/haocaocu/Errors/double_menu_zpswlgji2cw.png[/IMG]
Who knows how to get dished out the "login.aspx" help me with. Thank you
Posted
Comments
[no name] 10-Sep-15 5:16am    
Where you are storing value in Session? Is that implemented in Login page?

Secondly when you are logging for first time are you able redirect to your landing(home page)?
haocaocu 10-Sep-15 5:37am    
Thanks for repply.
Session I is stored in the page iDOC.master value and the Session ["username"] == null it will shift to Login.aspx
[no name] 10-Sep-15 5:58am    
When you browse the application for first time application should redirect you to Login page. On login page user has to enter the credential. Once user is valid then store user info in session and redirect to your landing page.

What ever your landing page is refering to master page it should check session in master page Page_Load(..) method.
ZurdoDev 10-Sep-15 7:43am    
I don't understand what your question is.

1 solution

hi
you use session in iframe but Session is relative to the user and site, not the page

Alternatively, you could just pass the value on the querystring to the iframe. I am not a fan of this though as it means the user can tamper with the variable. Instead what i like to do is generate a random key (guids are good for this), use that as the Session key to store the variable, and then pass the key through on the querystring - still not foolproof, but it obfuscates things (the user cannot tamper with the variable value), and it prevents hardcoding of any keys in to your source code (as different pages need to know the same Session key).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900