I have a Business Layer set up as another C# project within my solution, I need to call HttpContext but no matter what I try I cannot get it to reference correctly.
I have tried getting Visual Studio to pick up the reference needed with no luck, and I have also tried putting a reference to System.Web manually but these do not seems to work.
I have also noticed that Session is not being found as well.
Below is the code snippet I’ve used
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace BussinessLayer
{
class UserPermissions
{
public void redirectToLogin()
{
if (Session["user"] == null)
{
HttpContext.
if (HttpContext.Current.Request.Cookies["userName"] == null)
{
HttpContext.Current.Response.Redirect("/login.aspx");
}
}
}
}
}
Does anyone know whay HttpContext or Session are not being found?
This is to do with targeting the .NET 4 Client Profile. You’ll be able to fix this by retargeting your project to the full .NET Framework 4.