Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > WebControl, WSS, Session

Reply
Thread Tools

WebControl, WSS, Session

 
 
chris
Guest
Posts: n/a
 
      11-22-2007
'm having some problems with a WebControl, Sharepoint and
SessionState. and NullReferences.

Somewhere, this method it throwing a NullReference Exception. It
began when I added the session information.

Options for null -
base - not likely - worked before SS added.

I think I handled the case of the empty session appropriately, if not
overzealously. Is there something funky about WSS and SessionState? Or
am I getting the SessionState from the wrong place?

Class Declaration: public class WebQuizControl : WebControl

The Method:
protected override void CreateChildControls()
{
base.EnsureChildControls();
if ( !isConfigured ) return;
object temp = null;
if (! HttpContext.Current.Session.IsNewSession)
temp = HttpContext.Current.Session["questionSet"];

// Does C# shortcut here? if temp == null is the castI
executed?
if ( temp == null || ( temp as ExamCreator ) == null )
{
questionSet = new ExamCreator( Association, course,
module ); // parameters are valid
HttpContext.Current.Session.Add( "questionSet",
questionSet );
}
else // Probably not in here, as it crashes on initial
load.
{
questionSet =
HttpContext.Current.Session["questionSet"] as ExamCreator;
}
foreach ( Question q in questionSet.Questions )
{
this.Controls.Add( q );
}

// [snip] .. add submit, reset etc.
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Mike Larkin ASP .Net 1 05-23-2005 12:33 PM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM
Which is faster? Dim dv As New DataView(session("myDataTable")) or CType(session("myDataTable")) Andreas Klemt ASP .Net 1 07-23-2003 12:18 AM



Advertisments