Print Page | Close Window

Open in new window upon clicking Login

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=28807
Printed Date: 28 March 2026 at 6:27pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Open in new window upon clicking Login
Posted By: iSec
Subject: Open in new window upon clicking Login
Date 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?



Replies:
Posted By: dpyers
Date 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.


Posted By: iSec
Date Posted: 26 August 2010 at 7:41am
dpyers, dude you r0ck!!

I have previously tried inserting the 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!!!!




-------------
"When it gets dark enough, you can see the stars"
-Charles A. Beard


Posted By: iSec
Date 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!



-------------
"When it gets dark enough, you can see the stars"
-Charles A. Beard


Posted By: dpyers
Date 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 %>




-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: iSec
Date 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?

-------------
"When it gets dark enough, you can see the stars"
-Charles A. Beard



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net