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(string errorString)
{
HttpContext.Current.Session["error"] = errorString;
HttpContext.Current.Reponse.Redirect("Errors.aspx" ); // << produces
error
}
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Kavvy" <ka*@kav.kav> wrote in message
news:md******************@text.news.blueyonder.co. uk...
"Kavvy" <ka*@kav.kav> wrote in message
news:gc****************@text.news.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.HttpResponse.Redirect(string)'"
Oops,
here is the code
private void errorScreen(string errorString)
{
HttpContext.Current.Session["error"] = errorString;
HttpResponse.Redirect("Errors.aspx"); // << produces error
}