• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 441
  • Last Modified:

Create an ASP session from a JSP page

Sounds a bit odd bit here is the scenario:

I have a JSP web app with a login page.  Within this site, there is a page with an <IFRAME> tag that points to an ASP page.  The ASP page requires credentials (via basic authentication) but I don't want the user to be forced to log in again.  The credentials are the same.  I would like to 'invisibly' call the ASP page (or another ASP page written for this purpose?) from the JSP login page once I have the credentials and establish an ASP session so that when the page containing the IFrame is hit, a session will already exist for the user and they will not be prompted.  The user must not know the call to the ASP is being done.  It should be one seamless login to the JSP app from their perspective.

How can this be done?
0
craigdawson
Asked:
craigdawson
1 Solution
 
cheekycjCommented:
Use URLConnection like shown here:
http://www.javaworld.com/javatips/jw-javatip34.html
or
http://www.javaworld.com/javaworld/javatips/jw-javatip41.html

And then send the login credentials to an ASP page.  That will receive the credentials and log the user in and create session data for them.

CJ
0
 
craigdawsonAuthor Commented:
That might work but I can't run Java code on the client.  Applets are off limits for this project. A scripting approach is what I need (I think).
0
 
cheekycjCommented:
No this code would be in your servlet/jsp

you can http post/get to the asp page in your servlet/jsp code and create the asp session that way.

CJ
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
craigdawsonAuthor Commented:
But the browser won't have the session context when it loads the <IFRAME> pointing to the ASP page.  The user will still be prompted to login.
0
 
cheekycjCommented:
the session should be based on a cookie.

so when the browser requests the asp page and sends the session id cookie, the ASP page should identify it.

your code will have to send the session id cookie to the asp page and set it in the response in the servlet/jsp.

CJ
0
 
kennethxuCommented:
In addition, your jsp and asp server must at least belongs to same domain. and the cookie must be set at domain level. otherwise cookie set by jsp server won't be able to read by asp server.
0
 
craigdawsonAuthor Commented:
Cheekyci: I can't accept your comment as answer since I never got that to work.  Instead, I did this:

From JSP login, redirect to ASP page sending credentials with URL.  From ASP, redirect back to JSP sending credentials back on query string with password scrambled.  On JSP, rebuild with credentials and submit.  A bit convoluted but it works.
0
 
cheekycjCommented:
ok. atleast you got it working.

Would you like this questiond to be PAQ'd and your pts refunded?

CJ
0
 
girionisCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- To be PAQed and points NOT refunded.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0
 
GhostModCommented:
PAQed - no points refunded (of 250)

GhostMod
Community Support Moderator
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now