Answered by:
problem with httpcontext (Session variable) in sharepoint web part

Question
-
Hi all,
I am devloping web part for sharepoint 2007 with sp2. I have written code to assign value to session variable in createchildcontrols method and I am getting the error " Unexpected error occured" when the web part is loaded in the page. If I reomve the code which assigns value to session varable web part works fne . Can any help me regarding this issue. I am using the fallowing code to assign value to sessio variable
HttpContext.Current.Session["SpQuery"] = "text value";
If I remove this code web part works fine..
did any one face the same problem
Sunday, December 12, 2010 6:08 AM
Answers
-
Hi,
You can try it again with the following document.
http://technet.microsoft.com/en-us/library/cc263527%28office.12%29.aspx#section2
Microsoft Online Community Support- Proposed as answer by Daniel Dragnea Tuesday, December 14, 2010 11:52 PM
- Marked as answer by KeFang Chen Friday, December 17, 2010 7:01 AM
Monday, December 13, 2010 5:57 AM -
hi
you can also check the following forum thread which is marked as solved: How to use sessions in Custom Web Part . I think it is the same problem as in your case.
Blog - http://sadomovalex.blogspot.com
CAML via C# - http://camlex.codeplex.com
Graphs visualization in Sharepoint - http://spgraphviz.codeplex.com- Marked as answer by KeFang Chen Friday, December 17, 2010 7:01 AM
Monday, December 13, 2010 9:56 AM
All replies
-
You may not enabled session in you web.config. By default session is disable so cross check your web.config and make sure you have enabled
session .Search for enableSessionState="false"
Sunday, December 12, 2010 8:22 PM -
I have enabled it even then I am getting the same problemMonday, December 13, 2010 5:06 AM
-
Hi,
You can try it again with the following document.
http://technet.microsoft.com/en-us/library/cc263527%28office.12%29.aspx#section2
Microsoft Online Community Support- Proposed as answer by Daniel Dragnea Tuesday, December 14, 2010 11:52 PM
- Marked as answer by KeFang Chen Friday, December 17, 2010 7:01 AM
Monday, December 13, 2010 5:57 AM -
hi
you can also check the following forum thread which is marked as solved: How to use sessions in Custom Web Part . I think it is the same problem as in your case.
Blog - http://sadomovalex.blogspot.com
CAML via C# - http://camlex.codeplex.com
Graphs visualization in Sharepoint - http://spgraphviz.codeplex.com- Marked as answer by KeFang Chen Friday, December 17, 2010 7:01 AM
Monday, December 13, 2010 9:56 AM