473,796 Members | 2,583 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 #1
13 4704
What is it you expect to catch from a Response.Redire ct() ?
I suggest you look at a sample of validating a URL instead of the try/catch
on the redirect

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
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 #2
Tim
Hello Curt,
I'm trying to "catch" that the page being tested correctly tried to
Redirect to another page.

Can you provide an article that discusses further validating a URL - I'm not
seeing how this would help unit test the page.

Thanks,
Tim

"Curt_C [MVP]" wrote:
What is it you expect to catch from a Response.Redire ct() ?
I suggest you look at a sample of validating a URL instead of the try/catch
on the redirect

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
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 #3
Response.Redire ct accepts two parameters the second being to abort the
current thread or continue with execution. Maybe look into that, it might
help your cause.
Enrique.
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
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 #4
What are you trying to "test"? If the page is there or some processing that
happens on the page?
I mean when you Response.Redire ct() there is NO return value, it always
executes, there is nothing to try/catch.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:41******** *************** ***********@mic rosoft.com...
Hello Curt,
I'm trying to "catch" that the page being tested correctly tried to
Redirect to another page.

Can you provide an article that discusses further validating a URL - I'm
not
seeing how this would help unit test the page.

Thanks,
Tim

"Curt_C [MVP]" wrote:
What is it you expect to catch from a Response.Redire ct() ?
I suggest you look at a sample of validating a URL instead of the
try/catch
on the redirect

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
> 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 #5
Tim
I'm trying to write a unit test to check (1) if page correctly does a
Redirect, (2) Ideally check the value of the page it's trying to redirect to.

Response .Redirect doesn't have a return value, but it does have an affect
--> navigating to a new page. I'm trying to test that the page was about to
do the correct affect (navigate to the new page), and then I want to cancel
that so the main host program can still run all the other tests.

It's seeming like this is very non-standard, and I'll try to find a more
standard approach.

Tim

"Curt_C [MVP]" wrote:
What are you trying to "test"? If the page is there or some processing that
happens on the page?
I mean when you Response.Redire ct() there is NO return value, it always
executes, there is nothing to try/catch.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:41******** *************** ***********@mic rosoft.com...
Hello Curt,
I'm trying to "catch" that the page being tested correctly tried to
Redirect to another page.

Can you provide an article that discusses further validating a URL - I'm
not
seeing how this would help unit test the page.

Thanks,
Tim

"Curt_C [MVP]" wrote:
What is it you expect to catch from a Response.Redire ct() ?
I suggest you look at a sample of validating a URL instead of the
try/catch
on the redirect

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
> 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 #6
Tim
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

"Enrique Santa Cruz" wrote:
Response.Redire ct accepts two parameters the second being to abort the
current thread or continue with execution. Maybe look into that, it might
help your cause.
Enrique.
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
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 #7
That might be best. It's one of those cases where you can't test. I mean you
dont know if it worked till it's on the new page, and at that point the
calling page isn't active anymore.... kind of like testing to see if a gun
fires by firing it... to late to get the bullet back in the gun afterwards.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I'm trying to write a unit test to check (1) if page correctly does a
Redirect, (2) Ideally check the value of the page it's trying to redirect
to.

Response .Redirect doesn't have a return value, but it does have an affect
--> navigating to a new page. I'm trying to test that the page was about
to
do the correct affect (navigate to the new page), and then I want to
cancel
that so the main host program can still run all the other tests.

It's seeming like this is very non-standard, and I'll try to find a more
standard approach.

Tim

"Curt_C [MVP]" wrote:
What are you trying to "test"? If the page is there or some processing
that
happens on the page?
I mean when you Response.Redire ct() there is NO return value, it always
executes, there is nothing to try/catch.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:41******** *************** ***********@mic rosoft.com...
> Hello Curt,
> I'm trying to "catch" that the page being tested correctly tried to
> Redirect to another page.
>
> Can you provide an article that discusses further validating a URL -
> I'm
> not
> seeing how this would help unit test the page.
>
> Thanks,
> Tim
>
> "Curt_C [MVP]" wrote:
>
>> What is it you expect to catch from a Response.Redire ct() ?
>> I suggest you look at a sample of validating a URL instead of the
>> try/catch
>> on the redirect
>>
>> --
>> Curt Christianson
>> Owner/Lead Developer, DF-Software
>> Site: http://www.Darkfalz.com
>> Blog: http://blog.Darkfalz.com
>>
>>
>> "Tim" <Ti*@discussion s.microsoft.com > wrote in message
>> news:6F******** *************** ***********@mic rosoft.com...
>> > 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 #8
Just comment out the redirect, and write an entry to the event log, text
file or database instead.

Jeff
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:41******** *************** ***********@mic rosoft.com...
Hello Curt,
I'm trying to "catch" that the page being tested correctly tried to
Redirect to another page.

Can you provide an article that discusses further validating a URL - I'm not seeing how this would help unit test the page.

Thanks,
Tim

"Curt_C [MVP]" wrote:
What is it you expect to catch from a Response.Redire ct() ?
I suggest you look at a sample of validating a URL instead of the try/catch on the redirect

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:6F******** *************** ***********@mic rosoft.com...
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 #9
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 #10

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
5572
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
3706
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
1385
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
8656
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
4573
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
10455
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
10228
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...
0
10006
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
9052
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...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
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
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.