473,394 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Open web page in new window

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.

Nov 19 '05 #1
3 1150
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/

Nov 19 '05 #2
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/


Nov 19 '05 #3
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/

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
6
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page...
4
by: Dan Cruz | last post by:
Below are two files: Main.asp and Help.asp. I've stripped it down to the 'barest-of bones' so that anyone willing to help can duplicate the problem on their own systems. ***Main.asp*** looks...
10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
8
by: Dominic Tocci | last post by:
I'm searching for a way to use window.open on my web page to open a window in firefox that allows the sidebars to work (bookmarks, history, etc). When I use the following: var...
3
by: ACaunter | last post by:
Hi all, I need to set a session variable and open a new window with a single click of an asp.net button. My problem is that it always takes two clicks.. one sets the session and the other opens...
6
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
11
by: Dave | last post by:
For some reason, the below lines only work on select machines. All machines are running IE6. IE SP's and OS's vary. When it doesn't work, default.aspx (the page that this code is in) opens and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.