473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Error using Request and Response

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
2 14241
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mohammed Mazid | last post by:
Can anyone please help me here? Basically I have modified the source code and understood it but when I update a record in the db using a JSP, it gives me an error "The flight you selected does...
7
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard...
2
by: Christopher Johannsen | last post by:
Good Day: I am working on building a tool Using ASP/COM & IIS5.1 for a non-administrative technical support team to change domain passwords for users. I have the basic interface built and...
4
by: Bryan Tang | last post by:
I built an ASP to search the content in index server. It is ok if search in English. Whenever I search in Chinese, I will got the following error message, CreateRecordset ?u?~ '80004005' ...
1
by: iam247 | last post by:
Hi I have a web page which receives information from a form (using request.form) and also attempts to look at an Access query to read in recoeds to a variable named rsGroup. When I have the...
2
by: Joe | last post by:
Hello All, I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message, System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. ...
4
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku...
3
by: namewitheldbyrequest | last post by:
"The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope" I created a Web Service: I imported System.Data.SqlClient so I could access SQL...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
1
by: MehtabKhan | last post by:
Any one who tell me what’s wrong with this code. When I pass values to pay pal by using www.sandbox.paypal.com/cgi-bin/webscr all the code are working well. The orders are generating accurately....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.