L
Lauchlan M
Hi.
I'm using ASP.NET, getting an "Object reference not set to an instance of an
object" error.
In my login.aspx page I have:
string[] arrUserRoles = new string[] {"UserRole"};
Context.Items.Add("UserRoles", arrUserRoles);
Context.User = new
System.Security.Principal.GenericPrincipal(Context.User.Identity,
arrUserRoles);
In another page I have
string[] arrUserRoles = {}; <-- call this line a
arrUserRoles = (string[]) HttpContext.Current.Items["UserRoles"]; <--- Call
this line b . . . error on this line
Label1.Text = arrUserRoles.Length.ToString();
If I comment out line b it works (displays 0 as it should). If I put line b
back in, it throws the error.
Any suggestions on what's wrong?
Also, how do I test for the context variable arrUserRoles being defined?
Thanks!
Lauchlan M
I'm using ASP.NET, getting an "Object reference not set to an instance of an
object" error.
In my login.aspx page I have:
string[] arrUserRoles = new string[] {"UserRole"};
Context.Items.Add("UserRoles", arrUserRoles);
Context.User = new
System.Security.Principal.GenericPrincipal(Context.User.Identity,
arrUserRoles);
In another page I have
string[] arrUserRoles = {}; <-- call this line a
arrUserRoles = (string[]) HttpContext.Current.Items["UserRoles"]; <--- Call
this line b . . . error on this line
Label1.Text = arrUserRoles.Length.ToString();
If I comment out line b it works (displays 0 as it should). If I put line b
back in, it throws the error.
Any suggestions on what's wrong?
Also, how do I test for the context variable arrUserRoles being defined?
Thanks!
Lauchlan M