473,804 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cancel a Response.Redire ct

Tim
Hello,
Is there a way to "cancel" a response.Redire ct? For example, in the code
below, could I insert anything in the Catch statement that would cancel the
redirect and resume flow after the try-catch?

Try
Response.Redire ct(strPage)
Catch ex1 As Threading.Threa dAbortException
ex1 = ex1
'Cancel Respone here
End Try
'Resume flow here

I am trying to write unit tests for pages that include Redirects.

Thanks for any advice,
Tim
Nov 18 '05
13 4707
Tim
Hey Scott,
I have another class in a web application that calls that page like:
WebForm1 p = new WebForm1();
p.SomeMethodOnW ebForm1();

Tim
"Scott Allen" wrote:
Tim - just curious what / how you are testing the page. With some sort
of HTTP client? Could you look for the 302 redirect response code?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Nov 2004 12:40:02 -0800, Tim <Ti*@discussion s.microsoft.com >
wrote:
Thanks - but that would require me to change the original page that is being
tested, which I cannot do. All my code is limited to the unit-test that calls
the page.

Tim


Nov 18 '05 #11
So you want to change the behavior of the page without changing anything in
the page?

Why can't you change the page? Did you write it? Can you "talk" to the
developers??

Jeff
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:E4******** *************** ***********@mic rosoft.com...
Hey Scott,
I have another class in a web application that calls that page like:
WebForm1 p = new WebForm1();
p.SomeMethodOnW ebForm1();

Tim
"Scott Allen" wrote:
Tim - just curious what / how you are testing the page. With some sort
of HTTP client? Could you look for the 302 redirect response code?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Nov 2004 12:40:02 -0800, Tim <Ti*@discussion s.microsoft.com >
wrote:
Thanks - but that would require me to change the original page that is beingtested, which I cannot do. All my code is limited to the unit-test that callsthe page.

Tim


Nov 18 '05 #12
Tim
> So you want to change the behavior of the page without changing anything in
the page? No - I want the page to produce the same effect (send an "output" to try to
redirect to another page), but I want to trap that "output" and prevent it
from actually redirecting.

I can't comment out the redirects, but I could have the redirects abstracted
to a method that returns a string, and then I could check the string value to
make sure it's correct.

I can talk to the developers.

Tim

"Jeff Dillon" wrote:
So you want to change the behavior of the page without changing anything in
the page?

Why can't you change the page? Did you write it? Can you "talk" to the
developers??

Jeff
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:E4******** *************** ***********@mic rosoft.com...
Hey Scott,
I have another class in a web application that calls that page like:
WebForm1 p = new WebForm1();
p.SomeMethodOnW ebForm1();

Tim
"Scott Allen" wrote:
Tim - just curious what / how you are testing the page. With some sort
of HTTP client? Could you look for the 302 redirect response code?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Nov 2004 12:40:02 -0800, Tim <Ti*@discussion s.microsoft.com >
wrote:

>Thanks - but that would require me to change the original page that is being >tested, which I cannot do. All my code is limited to the unit-test that calls >the page.
>
>Tim
>


Nov 18 '05 #13
Um..like someone said earlier??

Just comment out the redirect, and write an entry to the event log, text
file or database instead
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:61******** *************** ***********@mic rosoft.com...
So you want to change the behavior of the page without changing anything in the page? No - I want the page to produce the same effect (send an "output" to try

to redirect to another page), but I want to trap that "output" and prevent it
from actually redirecting.

I can't comment out the redirects, but I could have the redirects abstracted to a method that returns a string, and then I could check the string value to make sure it's correct.

I can talk to the developers.

Tim

"Jeff Dillon" wrote:
So you want to change the behavior of the page without changing anything in the page?

Why can't you change the page? Did you write it? Can you "talk" to the
developers??

Jeff
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:E4******** *************** ***********@mic rosoft.com...
Hey Scott,
I have another class in a web application that calls that page like:
WebForm1 p = new WebForm1();
p.SomeMethodOnW ebForm1();

Tim
"Scott Allen" wrote:

> Tim - just curious what / how you are testing the page. With some sort > of HTTP client? Could you look for the 302 redirect response code?
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Thu, 4 Nov 2004 12:40:02 -0800, Tim <Ti*@discussion s.microsoft.com > > wrote:
>
> >Thanks - but that would require me to change the original page that
is being
> >tested, which I cannot do. All my code is limited to the unit-test
that calls
> >the page.
> >
> >Tim
> >
>
>


Nov 18 '05 #14

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

Similar topics

3
3702
by: news.public.microsoft.com | last post by:
Hi everyone, I have a VB.NET web form with some field validators and Save and Cancel buttons. What I want to do is on the Cancel button On_Click event, Response.Redirect to another page. The problem is that the client-side validation occurs before even reaching the event for the Cancel button. I've tried some ways to disable only the client-side validation, but I find it a poor design that you can't have a command button bypass the...
3
5573
by: Mvk | last post by:
Hi; I have a simple aspx form. I have put a textbox and 2 buttons on it. The textbox is linked to a requiredfieldvalidator. Click on button 1 (= ok button) = Store value in textbox in database. Click on button 2 (= cancel button) = Redirect with Response.Redirect("AnotherPage.aspx") Now I have the following problem. When I click on the "Cancel"-button the
7
3710
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a satisfactory answer (check your browser) so now that I've had the time to set up a reasonable little test that I can post somewhere, I'll try again. The app I've written has three ASPX pages. One is a combined page which writes a little text...
3
2415
by: MB | last post by:
Hi, I am doing a project which uses asp.net to develop its forms. The form uses validation web controls to validate the data entered in text boxes. When Cancel Button is pressed which is to exit from the current page and go to the previous page, the validation controls activate because data has not been entered, and the user cannot cancel. I have used Response.Redirect(webpage) but the validations activates and unless I enter some data...
2
5361
by: wiewiek | last post by:
Is there a way to go back to the previous page when a button (Cancel button) is hot? It's an ASP control. Thanks
3
1387
by: David Thielen | last post by:
Hi; I am guessing how to do this is very easy - but I can't find it anywhere. I have a cancel button on my form and if the user clicks it, I want to perfomr no validation and redirect to a specific page with the browser url showing the page redirected to. How can I do this? --
4
8657
by: Dabbler | last post by:
I'm trying to code a FormView page to return to the Gridview List if the user clicks the Cancel button while in insert mode but nothing happens with the following code: void VanDetailFormView_ItemCommand(Object sender, FormViewCommandEventArgs e) { if (e.CommandName == "Cancel") { Response.Redirect("VanList.aspx");
5
4575
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 a session variable, and if it is not present, does a Response.Redirect to a webpage for the CAS passing a url parameter for the url to post back to. The CAS provides a page for the user to log into, validates the username and password, and then...
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10351
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10096
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.