Author |
Topic Search Topic Options
|
iSec
Senior Member
Joined: 13 February 2005
Status: Offline
Points: 1140
|
Post Options
Thanks(0)
Quote Reply
Topic: Open in new window upon clicking Login Posted: 25 August 2010 at 6:36am |
I have a .NET application (email system) based on a google email API. Currently, when a user clicks "Login" after entering their login info, the page redirects the user to a google.com based page. I would like to have the login form on my website's homepage to open in a new window when the user clicks Login or hit the Enter key. That way the user can still be on my website and also have the email page open in its own window.
- Frames won't work.
- Can't use javascript because the login page generates a unqiue value each time the page is refreshed, and that value is like an authentication token that must be preserved...
Is there anyway to do this while preserving the authentication data?
|
|
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3938
|
Post Options
Thanks(0)
Quote Reply
Posted: 25 August 2010 at 5:15pm |
To keep your tokens, rather than opening your current page in a new window, open the new page in a new window using target="_blank" in the link. You can use javascript to set the focus to the new window, leaving the old one in the background.
|
Lead me not into temptation... I know the short cut, follow me.
|
|
iSec
Senior Member
Joined: 13 February 2005
Status: Offline
Points: 1140
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2010 at 7:41am |
dpyers, dude you r0ck!!
I have previously tried inserting the target="_blank" value into the code below, i feel bad for myself!
The code for the login button looks like this:
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Login" ValidationGroup="some-value" /> |
I tried inserting target="blank" in that tag, but it didn't do anything. But after reading your reply i put it in the <form> tag and it freaking worked this time!!!!
Edited by iSec - 26 August 2010 at 7:44am
|
"When it gets dark enough, you can see the stars"
-Charles A. Beard
|
|
iSec
Senior Member
Joined: 13 February 2005
Status: Offline
Points: 1140
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2010 at 7:47am |
Now here's something I'd like some help with:
When the page opens in a new window, can the page in the background be auto-refreshed to erase the login credentials in case the user walks away from their computer and someone else clicks login and be able to login with the info that was already inputted? If so, how do I do it?
The other question I have is, what's the best way to integrate that ASP.NET login form into a classic ASP page? My homepage is based on classic ASP, but this system is built with .NET. Thanks for all your help!
Edited by iSec - 26 August 2010 at 7:52am
|
"When it gets dark enough, you can see the stars"
-Charles A. Beard
|
|
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3938
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2010 at 9:33am |
You can use either meta tags or javascript to handle a page refresh on either form.
On the second, login form, you'd want to also use a meta tag no-cache option and use javascript to clear the history so if someone hits the back button, their browser won't auto fill the form.
Don't forget to do a check for javascript and redirect them to a message stating it must be enabled.
Most hosts use a 20 minute session timer before expiring the session on the host. You can set that timer in either classic asp or .net code to whatever you want. I'd set it to expire 10-15 seconds before the page refresh.
I'd put the .net form into a separate html iframe container.
EDIT: no-cache can be tricky based upon the browser type. IIRC, there's several additional things that can be set using asp code that will handle 99% of the possible glitches. Something I found in on of my asp pags looks like this: <% Response.CacheControl = "no-cache" %>> <% Response.AddHeader "Pragma", "no-cache" %> <% Response.Expires = -1 %>
Edited by dpyers - 26 August 2010 at 9:39am
|
Lead me not into temptation... I know the short cut, follow me.
|
|
iSec
Senior Member
Joined: 13 February 2005
Status: Offline
Points: 1140
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2010 at 11:14pm |
I tried the inline frame option, but for some reason upon clicking login it re-opens the login page in its own window, prompting the user to login, any idea why?
Edited by iSec - 26 August 2010 at 11:18pm
|
"When it gets dark enough, you can see the stars"
-Charles A. Beard
|
|