473,503 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

response object

TJS
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile
Nov 18 '05 #1
7 1113
Any class cannot call Redirect, it has to have access to an HttpResponse
instance, for instance the Response property on a Page object. You would
need to provide the Page object to any methods that need to perform a
redirect.

"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile

Nov 18 '05 #2
TJS
there must be a simple solution...

if the condition fails I want to send them to an error page

how can this be done ?
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Any class cannot call Redirect, it has to have access to an HttpResponse
instance, for instance the Response property on a Page object. You would
need to provide the Page object to any methods that need to perform a
redirect.

"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile


Nov 18 '05 #3
Try System.Web.HttpContext.Current.Response.Redirect.

Of course if you try to use this when there is no http context available,
the Current property will evaluate to null, and trying to get its Response
property will throw a null reference exception.

"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile

Nov 18 '05 #4
Should have thought of that. Anyway, this is the same HttpResponse instance
that the Page object has.
"Marina" <so*****@nospam.com> wrote in message
news:OJ**************@TK2MSFTNGP12.phx.gbl...
Try System.Web.HttpContext.Current.Response.Redirect.

Of course if you try to use this when there is no http context available,
the Current property will evaluate to null, and trying to get its Response
property will throw a null reference exception.

"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile


Nov 18 '05 #5
If that is what you want, then you should be able to configure ASP.NET to
redirect to an error page when it receives an unhandled exception.

"TJS" <no****@here.com> wrote in message
news:OM*************@TK2MSFTNGP11.phx.gbl...
there must be a simple solution...

if the condition fails I want to send them to an error page

how can this be done ?
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Any class cannot call Redirect, it has to have access to an HttpResponse
instance, for instance the Response property on a Page object. You would need to provide the Page object to any methods that need to perform a
redirect.

"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile



Nov 18 '05 #6
Hello TJS,

HttpContext.Current.Response.Redirect
there must be a simple solution...

if the condition fails I want to send them to an error page

how can this be done ?

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Any class cannot call Redirect, it has to have access to an
HttpResponse instance, for instance the Response property on a Page
object. You would need to provide the Page object to any methods
that need to perform a redirect.

"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to
compile

--

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #7
TJS
thanks all ... your suggestions worked
"TJS" <no****@here.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
how do I use "response.redirect" in a class ?

I'm getting an error on "response is not declared" when I try to compile

Nov 18 '05 #8

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

Similar topics

11
2142
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
35
34324
by: Eitan | last post by:
Hello, How can I write a line (with carriage return + line feed) to the client ? response.write("abcd"), continue the last line, and doesn't put cr+lf. response.writeLn is illegal syntax... ...
2
4064
by: RobertHillEDS | last post by:
While using the Soap generated ASP code, I would like to dump the raw contents of the request and response objects using Response.AppendToLog. I have tried using variations of the following code,...
3
1681
by: Farooq Khan | last post by:
why does Response.Write in a method of code-beind class when called from inpage code (i.e in <%---%>), after creating object of that class, fails when called while it works perfectly ok while...
5
4263
by: Michael | last post by:
Hello, I have a separate Database class that handles any database work that all my asp.net pages can use. My problem is, many times I use try/catch to catch errors, and I want to output these...
4
2639
by: Jit Prasad | last post by:
I have been consuming a IBM Websphere (Java) web service using .Net 1.0 front end writen in VB.NET. The proxy class submits a soap request and gets a soap response. When I migrated the front-end...
4
11384
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...
2
3168
by: Michael D. Ober | last post by:
When I single step through the code below, it sends back the PDF file that is retrieved in the line fm.GetAccountPDF(...). When I run without single stepping, I get the master page for this page. ...
6
3522
by: mike.gilmore | last post by:
Hi, I'm trying to move all my custom validation code into the master page. Unfortunately anytime I use the response, request, or trace objects in any master page module (other than page_load), ...
1
6982
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
7451
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...
1
5000
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...
0
4667
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...
0
3161
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...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
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 ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
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...

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.