Hi,
Can anyone tell me why the following code produces the error
"An object reference is required for the nonstatic field, method, or
property 'System.Web.Htt pResponse.Redir ect(string)'" 2 6946
"Kavvy" <ka*@kav.kav> wrote in message
news:gc******** ********@text.n ews.blueyonder. co.uk... Hi,
Can anyone tell me why the following code produces the error
"An object reference is required for the nonstatic field, method, or property 'System.Web.Htt pResponse.Redir ect(string)'"
Oops,
here is the code
private void errorScreen(str ing errorString)
{
HttpContext.Cur rent.Session["error"] = errorString;
HttpResponse.Re direct("Errors. aspx"); // << produces error
}
Kavvy,
The reason for this is that the Redirect method is an instance method,
not a static method. You have to get an instance of the HttpResponse
method, like this:
private void errorScreen(str ing errorString)
{
HttpContext.Cur rent.Session["error"] = errorString;
HttpContext.Cur rent.Reponse.Re direct("Errors. aspx"); // << produces
error
}
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Kavvy" <ka*@kav.kav> wrote in message
news:md******** **********@text .news.blueyonde r.co.uk... "Kavvy" <ka*@kav.kav> wrote in message news:gc******** ********@text.n ews.blueyonder. co.uk... Hi,
Can anyone tell me why the following code produces the error
"An object reference is required for the nonstatic field, method, or property 'System.Web.Htt pResponse.Redir ect(string)'"
Oops,
here is the code
private void errorScreen(str ing errorString) { HttpContext.Cur rent.Session["error"] = errorString; HttpResponse.Re direct("Errors. aspx"); // << produces error }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Adrian Albisser |
last post by:
Hey to everybody, im just beginning to program in python. So i was trying
some function but always when i try the range function i get a error
message.
for number in range(1,100):
print number
Error---> There's an error in your program:
expected an indented block
|
by: Matthew Trunnell |
last post by:
Hi everyone,
I'm implementing the HTTP 206 Partial Content spec. This
requires an additional header of the form:
"Content-Range: xxx-yyy/zzz"
See http://www.w3.org/Protocols/rfc2616/rfc2616-
sec14.html#sec14.16
However, when I call the Response.AddHeader() method, I
get an exception throw from the private method
|
by: James Dixon |
last post by:
I am hitting a j2ee website that is using cookies to maintain session state.
In the headers, it has the syntax Set-Cookie:JSESSIONID=XXXXXXXXXXX
When I inspect the HTTPResponse.Cookies collection, it is not there
Does the cookie have to meet some other criteria other than set-cookie to be
put into that collection?
I didn't see an answer on any of the newsgroups or developer sites
Thanks
Jamie
|
by: Chris Simmons |
last post by:
Hello:
I am trying to better understand the HttpResponse.Filter property and,
although I think I "get it," I am wondering what is going on behind
the scenes.
I was initially stumped with the thing because all the samples I came
across kept using the property as an argument to the custom filter
Stream's constructor. What I then figured out was that this is the
way that multiple filters can be chained onto the Response stream. For
|
by: Paul |
last post by:
I have developed an ASP.NET web page with a VB.net for the code behind.
I would like to redirect the output of the web page so I can send it as
an Email. Or Redirect the HTTPResponse stream on the server to a
file. Any ideas would be appreciated.
Thank you
Paul
| |
by: Daniel Corbett |
last post by:
I am trying to save a file dynamically created in a webpage. I get the
following headers, but cannot figure out how to save the attachment. I am
basically trying to replicate what internet explorer would do in this case.
The headers I am getting are:
Headers {Content-Disposition: attachment; filename="dynamic_file.mdb"
Connection: close
Cache-Control: private
Content-Type: application/octet-stream
|
by: Vadim |
last post by:
Hi,
I will have to send a file to a user's browser to be opened in a Save, Open
manner, I am using HttpResponse.WriteFile for this, the info to be sent will
have to be first accumulated in a temp file in a temp directory and sent to
a user and then I would want to delete the temp file. Please let me know if
the following sequence will be correct:
HttpResponse.WriteFile(TempFileName)
HttpResponse.End
|
by: =?Utf-8?B?Um9iaW4=?= |
last post by:
I am looking for the most correct method of streaming a byte array to a web
browser as a pdf. Anyway, I see a lot of methods for HttpResponse and I don't
know how to properly use them. Here is my code:
Response.ContentType = "Application/pdf";
Response.BinaryWrite(myByteArray);
Response.End();
Specifically, do I need to worry about Buffer (T/F), AppendHeader(),
Clear(), Flush(). Should I use OutputStream instead of BinaryWrite?
|
by: somoza.albert |
last post by:
Hello,
I've been told that I can make my Web Pages render quicker if I set
the BufferOutput property of the HttpResponse Class to false. I have
a "test" Web App that works, but it doesn't seem to have the
HttpResponse Class. Where do I adjust this?
Thanks
Sam
Q3
|
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,...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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: 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...
| |