473,411 Members | 1,937 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,411 software developers and data experts.

Response.Write and Response.Redirect

On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!

Nov 17 '05 #1
4 19372
You have to response.write some javascript to do the redirect client side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...
On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!

Nov 17 '05 #2
What javascript would that be?
thanks!

Marina wrote:
You have to response.write some javascript to do the redirect client side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...
On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!



Nov 17 '05 #3
I got it. For those interested:
Response.Write("<script>location.href = WebPage.aspx';</script>");

thanks for the help.

Matthew Wieder wrote:
What javascript would that be?
thanks!

Marina wrote:
You have to response.write some javascript to do the redirect client
side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...
On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!



Nov 17 '05 #4
Just one additional thing. Using Response.Write() is dodgy at best with
ASP.Net. Try using Page.RegisterStartupScript() instead.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**************@SatoriGroupInc.com...
I got it. For those interested:
Response.Write("<script>location.href = WebPage.aspx';</script>");

thanks for the help.

Matthew Wieder wrote:
What javascript would that be?
thanks!

Marina wrote:
You have to response.write some javascript to do the redirect client
side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...

On my Page_Load event, i need to do some validation and then either let them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous page, the Response.Write gets eaten. How do I solve this issue?
thanks!

Nov 17 '05 #5

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

Similar topics

3
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect...
3
by: Gary | last post by:
I am having a strange problem that I cannot solve. I have an asp page that I use for a user to login and gain access to other pages. When the user logs in I set a couple of session variables like...
13
by: TinyTim | last post by:
I'm a newbie at ASP & HTML. It seems that when you use server side code and you're going to return a customized HTML form with several fields and labels, you have to do an extensive amount of...
3
by: Sehboo | last post by:
On my ASP page, when I click a button, I want to do three things: 1. Check for some values. 2. Open a new window and pass some values as query string. 3. Redirect to some other page Here...
3
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything...
1
by: Kevin Blount | last post by:
Background: My script is designed to only allow the downloading of a file if a cookie exists to say that someone is logged into my companies site. A colleague set up a test area the extension...
12
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.