I am using ViewState to save some data from a page to another on sharepoint, and when I write this line at the Page_Load event I get an error but it doesn’t say anything. Any clue?
Label l = new Label();
l.Text = ViewState["user"].ToString();
and also this one
Session["user"] = (sender as LinkButton).Text;
Enable Sessionstate in the web.config in the pages section:
be careful though, if you are running a multi machine farm (i.e. more that 1 web front end / app server), your need SQL server based sessions (or the asp.net state service).
I suggest you do some reading up on SharePoint and session state BEFORE enabling it.
P.S. You can enable session state per page(s) as well, but the same warning goes for multi machine farms (