mathieu_cupryk
asked on
The as operator must be used with a reference type or nullable type ('int' is a non-nullable value type)
public static System.Int32 Age
{
get { return HttpContext.Current.Profil e.GetPrope rtyValue(" Age") as System.Int32; }
set { HttpContext.Current.Profil e.SetPrope rtyValue(" Age", value); }
}
Error 1 The as operator must be used with a reference type or nullable type ('int' is a non-nullable value type) C:\inetpub\wwwroot\OmegaLo ve\OL_Web\ App_Code\U serProfile .cs 49 26 C:\...\OL_Web\
{
get { return HttpContext.Current.Profil
set { HttpContext.Current.Profil
}
Error 1 The as operator must be used with a reference type or nullable type ('int' is a non-nullable value type) C:\inetpub\wwwroot\OmegaLo
using System;
using System.Web;
using System.IO;
using System.Xml.Serialization;
using System.Web.Caching;
public static class UserProfile
{
public class Personal
{
public static System.String UserName
{
get { return HttpContext.Current.Profile.GetPropertyValue("UserName") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("UserName", value); }
}
public static System.String Password
{
get { return HttpContext.Current.Profile.GetPropertyValue("Password") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("Password", value); }
}
public static System.String Email
{
get { return HttpContext.Current.Profile.GetPropertyValue("Email") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("Email", value); }
}
public static System.String FirstName
{
get { return HttpContext.Current.Profile.GetPropertyValue("FirstName") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("FirstName", value); }
}
public static System.String LastName
{
get { return HttpContext.Current.Profile.GetPropertyValue("LastName") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("LastName", value); }
}
public static System.DateTime DOB
{
get { return (System.DateTime)HttpContext.Current.Profile.GetPropertyValue("DOB"); }
set { HttpContext.Current.Profile.SetPropertyValue("DOB", value); }
}
public static System.Int32 Age
{
get { return HttpContext.Current.Profile.GetPropertyValue("Age") as System.Int32; }
set { HttpContext.Current.Profile.SetPropertyValue("Age", value); }
}
public static System.String Gender
{
get { return HttpContext.Current.Profile.GetPropertyValue("Gender") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("Gender", value); }
}
public static System.String Seeking
{
get { return HttpContext.Current.Profile.GetPropertyValue("Seeking") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("Seeking", value); }
}
public static System.String ConfirmationGUID
{
get { return HttpContext.Current.Profile.GetPropertyValue("ConfirmationGUID") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("ConfirmationGUID", value); }
}
public static System.String UserIP
{
get { return HttpContext.Current.Profile.GetPropertyValue("UserIP") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("UserIP", value); }
}
public static System.String SessionID
{
get { return HttpContext.Current.Profile.GetPropertyValue("SessionID") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("SessionID", value); }
}
}
public class Address
{
public static System.String Country
{
get { return HttpContext.Current.Profile.GetPropertyValue("Country") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("Country", value); }
}
public static System.String Region
{
get { return HttpContext.Current.Profile.GetPropertyValue("Region") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("Region", value); }
}
public static System.String City
{
get { return HttpContext.Current.Profile.GetPropertyValue("City") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("City", value); }
}
public static System.String ZipCode
{
get { return HttpContext.Current.Profile.GetPropertyValue("ZipCode") as System.String; }
set { HttpContext.Current.Profile.SetPropertyValue("ZipCode", value); }
}
}
public class Preferences
{
public static String Theme
{
get { return HttpContext.Current.Profile.GetPropertyValue("Theme") as String; }
set { HttpContext.Current.Profile.SetPropertyValue("Theme", value); }
}
public static String Culture
{
get { return HttpContext.Current.Profile.GetPropertyValue("Culture") as String; }
set { HttpContext.Current.Profile.SetPropertyValue("Culture", value); }
}
}
public static void Save()
{
HttpContext.Current.Profile.Save();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
excellent.
I will be posting two questions one with on how I can show all the information about a user. with that class and secondly one with serialization of that object,
I will be posting two questions one with on how I can show all the information about a user. with that class and secondly one with serialization of that object,
Open in new window