I dont think that casting is a problem here.
I use UserSession class for for storing variables:
public class UserSession:System.Web.UI.Page
{
public UserSession()
{
}
public static Int32 Priv1
{
get
{
UserSession vars = new UserSession();
if(vars.Session["Priv1"].Equals((Int32)0)) return 0;
return (Int32)(vars.Session["Priv1"]);
}
set
{
UserSession vars = new UserSession();
vars.Session["Priv1"] = value;
}
}
public static Int32 Priv2
{
get
{
UserSession vars = new UserSession();
if(vars.Session["Priv2"].Equals((Int32)0)) return 0;
return (Int32)(vars.Session["Priv2"]);
}
set
{
UserSession vars = new UserSession();
vars.Session["Priv2"] = value;
}
}
}
Then I call this class:
UserSession.Priv1=1;
UserSession.Priv2=1;
and then I redirect it to another page.
When I debug, on the first page UserSession.Priv1 and UserSession.Priv2 are filled with values, but when I make Response.Redirect their value is lost.
Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped