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
1,453 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
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

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.…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now