>Hello all,
>
>I just successfully converted my web application to VS 2010 from VS 2008 and found out that when there are session variables in the code behind file for a web form, the design form view encounters an error in rendering the page on the design form. The following link explains this:
>
>
http://blogs.msdn.com/b/webdevtools/archive/2010/04/15/rendering-issue-in-visual-studio-2010-when-accessing-the-session-state-in-the-oninit-method.aspx>
>I would like to know how any of you who have encountered this have addressed this issue.
The work-around in the link seems to be the way to go. I suppose if you have a *lot* of session variables then it might be worth a method to handle it:
public partial class Junk : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s = (string) GetSessionValue("Something");
}
object GetSessionValue(string s)
{
return (Context != null && Context.Session != null) ? Session[s] : null;
}
}