using Neo.Afx.Security;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Security;
namespace Neo.Afx.Common
{
public static partial class HttpContextHelper
{
#region QueryString
///
/// Returns the query string attached to the current HttpContext
///
public static string QueryString
{
get
{
return HttpContext.Current.Request.QueryString.ToString();
}
}
#endregion
#region IsAuthenticated
///
/// Indicates whether a user is logged in or not
///
public static bool IsAuthenticated
{
get
{
return HttpContext.Current.Request.IsAuthenticated && HttpContext.Current.User != null && HttpContext.Current.User.Identity != null && HttpContext.Current.User.Identity.IsAuthenticated && !String.IsNullOrEmpty(HttpContext.Current.User.Identity.Name);
}
}
#endregion
#region UserName
///
/// The username i.e. email address for the currently logged in user
///
public static string UserName
{
get
{
var user = "";
if (HttpContext.Current.User != null && HttpContext.Current.User.Identity != null && HttpContext.Current.User.Identity.IsAuthenticated)
{
user = HttpContext.Current.User.Identity.Name.ToLower();
}
return user;
}
}
#endregion
}
}