?
Solved

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

Posted on 2008-06-18
2
Medium Priority
?
1,501 Views
Last Modified: 2010-04-21
Hi ,

I am working on ASP.net 1.1, C#

In the CS file I have handled the exception handling.

There I want to add the referrer page if any

I added but I get the error

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


With below code



using System;
using System.Configuration;
using System.Web.Mail;

string ErrFullMessage = string.Empty;


if(Request.UrlReferrer != null)
{
      ErrFullMessage = ErrFullMessage+"<br> Url Referrer"+Request.UrlReferrer.ToString();
}


I also tried adding the assemblies but doesn't work


using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

Please guide

Thanks
0
Comment
Question by:tia_kamakshi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 2000 total points
ID: 21811829
Hello tia_kamakshi,

I assume that this is not a code-behind file.

In this case you need to use:

If(HttpContext.Current.Request.UrlReferrer !=null)

To explicitly reference the current request object. The request/server/response objects are normally available only to code-behind because they are partial classes and inherit the Page object which has these objects in it. If you need to refer to them from elsewhere use HttpContext.Current.Request etc.

Regards,

TimCottee
0
 

Author Closing Comment

by:tia_kamakshi
ID: 31468293
Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question