473,651 Members | 3,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

response object

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

I'm getting an error on "response is not declared" when I try to compile
Nov 18 '05 #1
7 1123
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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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.r illing.net> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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.Http Context.Current .Response.Redir ect.

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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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******** ******@TK2MSFTN GP12.phx.gbl...
Try System.Web.Http Context.Current .Response.Redir ect.

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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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.co m> wrote in message
news:OM******** *****@TK2MSFTNG P11.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.r illing.net> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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.Cur rent.Response.R edirect
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.r illing.net> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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.co m> wrote in message
news:OA******** ******@TK2MSFTN GP12.phx.gbl...
how do I use "response.redir ect" 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
2166
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 datagrid. I am using the viewstate object to store the Arraylist items on the page on postback. My PROBLEM is that I need to redirect the user to a new aspx page and on this new page i need to be able to access the items in my arraylist. Is this...
35
34427
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... Thank :)
2
4090
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, but I may be barking up the wrong tree with this approach. Any expert help would greatly be appreciated. Dim objReader Set objReader = CreateObject("MSSOAP.SoapReader") objReader.Load Request
3
1692
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 calling the same method same way except for creating object instead directly calling the method? i get this when trying to do that:- ************************************************** Response is not available in this context. Description: An...
5
4282
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 errors to the webpage with response.write(). Unfortunately Response.anything from within my class generate a "Response is not declared" error. How can I get Response to work from within a class, or is there a better way to handle errors in...
4
2652
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 to .NET1.1, the response from the web service appears as null in the proxy class. This only happens with .NET1.1, .NET1.0 is ok and works fine. I have played around with the System.Web.Services.Protocols.SoapDocumentMethodAttribute, but no luck....
4
11425
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 XMLHTTP object. However, when the page requested through the XML object makes a <%Response.Redirect()%> call, a new session is created each time. Is this a flaw in the XMLHTTP Object? How can I force the session to remain the same after a...
2
3180
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. I have actually saved the file returned by IE 7 as a text file and opened it in notepad, so I have confirmed that it is indeed the page master being returned. The code is in the code behind file for the aspx page and is called directly from a...
6
3540
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), " Object reference not set to an instance of an object." is the error I receive. Below is a sample of code that will not work on my web server. Any suggestions/advice are appreciated.
0
8361
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
8701
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
8466
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
7299
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
5615
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
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
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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
2
1588
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.