Solved

Write Session Data to iFrame

Posted on 2011-02-25
7
531 Views
Last Modified: 2012-08-13
I have an asp page, as seen in the attached. As you can see, the page use a Session to get the Username/Password and allow access.

I'm displaying this page in an iFrame, on machines on different domains. What I'm looking to achieve is to somehow pass the Username/Password into the session within the iFrame, so that I can navigate around the site without having to go to the login page first. Currently if I try to navigate to any other page than the Login.asp, I get a 'Session Expired' error, and it redirects to the login.asp page. So, if I can somehow pass the username and password into the remote session, via the iFrame, it should allow my to login.

The site is managed by oursleves, so some changes can be made to the login.asp page attached. LOGIN.txt
0
Comment
Question by:wint100
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:pateljitu
Comment Utility
Pages where you navigate via <iframe> you could pass querystring something as example

<iframe id="some_iframe" src="someiframpage.asp?username=test&password=password"
width="100%"  height="90%" scrolling="no" frameborder="0"> </iframe>

and within iframe pages have common include file that checks if you have session created based on the querystring value passed, if not create session and logon.

As you mentioned iframe pages are loading from different domain, same session cannot be used you would need to create session value based on domain you load page from.
0
 
LVL 1

Author Comment

by:wint100
Comment Utility
Sounds complicated, I'm trying to keep this as simple as possible.

I'm already passing querystring, with uname and pword, and also a parameter to forcelogin. This is all done on the login.asp page only though, no other asp pages have the code to work with the parameters passed. They only check to see if an active seesion exists, but I'm not sure how this is done. There are reference to include files in the other asp files, so maybe this is how it is checking the session.
0
 
LVL 15

Expert Comment

by:pateljitu
Comment Utility
It would be helpful if you could provide example how iframe is used on page, also noticed in code login.asp

' Added to 3.33 R2's LOGIN page to allow auto-login
Dim forceLogin
if (Request("forceLogin") = "true") then
  forceLogin = 1
  Response.Cookies("SavedUserInfo")("UserName") = AdminObj.Mask(UCase(Request("UName")))
  Response.Cookies("SavedUserInfo")("UserPass") = AdminObj.Mask(UCase(Request("UPass")))
else
  forceLogin = 0
end if

querystring parameter are uname and upass, just want to clarify you using correct parameter name, as you mentioned pword as parameter in your earlier comment.
0
What Security Threats Are You Missing?

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.

 
LVL 1

Author Comment

by:wint100
Comment Utility
That was just an example. The auto login works fine, and just trying to bypass te login page all together which is only possible is a valud session is active.
0
 
LVL 15

Expert Comment

by:pateljitu
Comment Utility
Without a working sample it is a bit tricky to resolve problem.

Just to get more idea how session needs to be utilized, trying an example, please correct me

www.example.com
This domain is where login.asp resides and is working fine and able to login user and create session. Page that loads in iFrame is on the same domain i.e. www.example.com

OR

page that loads in iFrame is on another domain for e.g. www.example2.com.
0
 
LVL 1

Accepted Solution

by:
wint100 earned 0 total points
Comment Utility
Hi,

I found a parameter on the destination page that allowed a Referer, so I was able to bypass the need for writing the session data, as it is now handled on the Page itself.

thanks
0
 
LVL 1

Author Closing Comment

by:wint100
Comment Utility
Problem resolved
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to dynamically set the form action using jQuery.

744 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

15 Experts available now in Live!

Get 1:1 Help Now