Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Open web page in new window

Reply
Thread Tools

Open web page in new window

 
 
akanihuu@yahoo.com
Guest
Posts: n/a
 
      10-19-2005
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.RedirectFr omLoginPage(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.

 
Reply With Quote
 
 
 
 
Jason Kester
Guest
Posts: n/a
 
      10-20-2005
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/

 
Reply With Quote
 
 
 
 
akanihuu@yahoo.com
Guest
Posts: n/a
 
      10-20-2005
I put the script code in the login.aspx.cs to replace the
Response.Redirect().
Jason Kester wrote:
> 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/


 
Reply With Quote
 
Jason Kester
Guest
Posts: n/a
 
      10-20-2005
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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Window.Open get new tab instead of new window in FireFox Fredzidd@gmail.com Javascript 1 02-29-2008 03:06 AM
window.open() doesn't open new Window in Opera PC HUA Javascript 2 05-19-2004 02:29 AM
Need to open a new browser window, not a new window Gordon ASP General 3 04-16-2004 10:46 PM
Open web page in New browser Window? Mike Lambert ASP .Net 2 10-24-2003 11:58 PM
How can I open a new window and ensure the page loaded creates a NEW session? Jazzis ASP General 4 09-26-2003 06:47 PM



Advertisments