Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2005

Tip: Looking for answers? Try searching our database.

Open web page in new window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
akanihuu@yahoo.com - 20 Oct 2005 00:43 GMT
I am creating a web application using C#.  I have a login page that is
used authenticate the user and redirect them to another web page called
Run.aspx that runs an executable that takes their username as a
parameter.  Currently I am using Response.Redirect(Run.aspx) to take
the authenticated user to the page.
Session ["UserName"] = userName.Text;
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(userName.Text,
false);
Response.Redirect("Run.aspx");
Now I need to take the authenticated user to the page by opening a new
window.  I have read most of the post concerning this subject and tried
the suggestions, but  I can't open a new window.  I have tried
something like this:
string script = "<script language='javascript'>window.open('Run.aspx',
'_blank');</script>";
Page.RegisterStartupScript("script", script);
and others, but nothing seems to work.  I would really appreciate any
help, thanks.
Jason Kester - 20 Oct 2005 01:51 GMT
uh, where are you putting that script?  In run.aspx itself?

And you've got issuse with your FormsAuthentication code.
Specifically, this line...

Response.Redirect("Run.aspx");

...will never get called.  RedirectFromLoginPage does it's own header
redirect, back to whatever page redirected to it in the first place.
So unless you came to the login screen by being kicked off of run.aspx,
you'll never end up back there.

If you want to force your users to see run.aspx (and run whatever
client-side scripts live there) immediately after login, lop off that
RedirectFromLoginPage line, and use SetAuthCookie instead.

Good luck!

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/
akanihuu@yahoo.com - 20 Oct 2005 04:31 GMT
I put the script code in the login.aspx.cs to replace the
Response.Redirect().
> uh, where are you putting that script?  In run.aspx itself?
>
[quoted text clipped - 21 lines]
> Get your own Travel Blog, with itinerary maps and photos!
> http://www.blogabond.com/
Jason Kester - 20 Oct 2005 06:45 GMT
Again, RedirectFromLoginPage will end processing.  No lines after that
will run.  That's why your code is not working.  It never gets a
chance.

As I said, use SetAuthCookie instead, and you'll at least get a chance
to see what your code does.

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.