By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,724 Members | 863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,724 IT Pros & Developers. It's quick & easy.

Error using Request and Response

P: n/a
Hi,

Working on .NET 2003. Using C# as server code.

I have created a class with following code...

using System;
using System.Data.OracleClient;
using System.Web;
using System.Web.SessionState;
namespace RADWebV5.RADAsp.Class
{
public static string LogOn(string UserID, string Password)
{
try
{
HttpCookie cookieABC = Request.Cookies["ABC"];
if (null == cookieABC || cookieABCToString() == "" ||
cookieABC.ToString() != "CI")
{
Response.Cookies["ABC"] = Session["PrimaryCI"];
}
}
catch (Exception err)
{
return err.Source
}
}

__________________

Error while compiling...
The type or namespace name 'Request' could not be found (are you missing a
using directive or an assembly reference?)

The type or namespace name 'Response' could not be found (are you missing a
using directive or an assembly reference?)

_____________________

Not sure what is missing?

Thanks,

- Reena
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Reena, the HttpRequest and Response are "exposed through the Request
property of the HttpApplication, HttpContext, Page, and UserControl
classes."(from MSDN) So, you need to pass a reference to one of those,
probably your page, or, if you already have a reference to one of these in
this class, just use that ref to access the Request or Response.

Hope that helps.

--
Greg Ewing [MVP]
http://www.citidc.com
"Reena" <pa*****@navsea.navy.mil> wrote in message
news:#R*************@TK2MSFTNGP10.phx.gbl...
Hi,

Working on .NET 2003. Using C# as server code.

I have created a class with following code...

using System;
using System.Data.OracleClient;
using System.Web;
using System.Web.SessionState;
namespace RADWebV5.RADAsp.Class
{
public static string LogOn(string UserID, string Password)
{
try
{
HttpCookie cookieABC = Request.Cookies["ABC"];
if (null == cookieABC || cookieABCToString() == "" ||
cookieABC.ToString() != "CI")
{
Response.Cookies["ABC"] = Session["PrimaryCI"];
}
}
catch (Exception err)
{
return err.Source
}
}

__________________

Error while compiling...
The type or namespace name 'Request' could not be found (are you missing a
using directive or an assembly reference?)

The type or namespace name 'Response' could not be found (are you missing a using directive or an assembly reference?)

_____________________

Not sure what is missing?

Thanks,

- Reena

Nov 15 '05 #2

P: n/a
Added reference..

HttpRequest Request = HttpContext.Current.Request;
HttpResponse Response = HttpContext.Current.Response;

Works. Thanks.

- Reena

"Greg Ewing [MVP]" <gewing@_NO_SPAM_gewing.com> wrote in message
news:Oc**************@TK2MSFTNGP12.phx.gbl...
Reena, the HttpRequest and Response are "exposed through the Request
property of the HttpApplication, HttpContext, Page, and UserControl
classes."(from MSDN) So, you need to pass a reference to one of those,
probably your page, or, if you already have a reference to one of these in
this class, just use that ref to access the Request or Response.

Hope that helps.

--
Greg Ewing [MVP]
http://www.citidc.com
"Reena" <pa*****@navsea.navy.mil> wrote in message
news:#R*************@TK2MSFTNGP10.phx.gbl...
Hi,

Working on .NET 2003. Using C# as server code.

I have created a class with following code...

using System;
using System.Data.OracleClient;
using System.Web;
using System.Web.SessionState;
namespace RADWebV5.RADAsp.Class
{
public static string LogOn(string UserID, string Password)
{
try
{
HttpCookie cookieABC = Request.Cookies["ABC"];
if (null == cookieABC || cookieABCToString() == "" ||
cookieABC.ToString() != "CI")
{
Response.Cookies["ABC"] = Session["PrimaryCI"];
}
}
catch (Exception err)
{
return err.Source
}
}

__________________

Error while compiling...
The type or namespace name 'Request' could not be found (are you missing a using directive or an assembly reference?)

The type or namespace name 'Response' could not be found (are you
missing a
using directive or an assembly reference?)

_____________________

Not sure what is missing?

Thanks,

- Reena


Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.