2
Answers

'System.Web.HttpRequest' does not contain a definition for 'Request'

Hi All.

I hope there is some one that can help me spread some light on the situation.

I have the following code:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


/// <summary>
/// This Class is used to determine weather or not the current user is logged in and allowed to view the page
/// which they are trying to access.
/// </summary>
public abstract class base_Normal
{
    public base_Normal()
    {
        string rawUrl = System.Web.HttpRequest.Request.RawUrl; //it tells me that it doesn't like this
        //Error    1    'System.Web.HttpRequest' does not contain a definition for 'Request'    C:\Websites\OryxSystems\App_Code\base_Normal.cs    19    49    C:\Websites\OryxSystems\

        if (!(Global.OryxSession.IsAuthenticSession))
        {
            if (!(Global.OryxSession.UserType == Global.eUserType.Admin))
            {
                if (!(Global.OryxSession.UserType == Global.eUserType.Normal))
                {
                    gblSettings.linkNumber = 4;
                    //This is where I wanna do a Response.Redirect("Login.aspx");
                }
            }
        }
    }
}


And every time I compile and try to run it, it gives me the error:

 'System.Web.HttpRequest' does not contain a definition for 'Request'

Basically, what I am trying to do is see weather the user is logged in or not and then decide from there if they can acess the page. What will happen is that the page in question will then inherit this class. I have done this is a VB.NET website that I wrote and I am trying to get it to work in C# but I am going wrong.

I have tried a few different ways of getting around it but with no luck. If there is any one who can help me, please do and if you need any further examples ('for the session') then please do ask.

Thanks in advance.

Answers (2)