I'm having an issue which should be pretty simple to solve. I want the "i
accept terms" button on my user terms page to redirect to the
myaccount.aspx
page if the current user is logged in with an account but back to the home
page if they aren't logged in. The problem I get is when the user profile
is
empty and I don't have it instatiated. I suck at C# and wanted to know if
anyone could tell me an easy way to get this done....
UserObject userProfile = UserObject.CurrentUser;
if(userProfile.IsAnonymous)
{
Response.Redirect("Default.aspx");
}
else
{
Response.Redirect("MyAccount.aspx");
}
this code only works if they are logged in, if they aren't i get an error
saying
"Object reference not set to an instance of an object"