Last year I posted a similar problem in http://forum.springframework.net/sho...yer-webservice I am now trying to do the same thing with an ashx page. Using Spring version 1.3
I have an ashx page in the presentation layer using spring.net and nHibernate in the typical configuration of presentation layer <- Web.xml -> Business Layer <- Business.xml -> Data Access layer.
I presume I need to do something similar to the solution mentioned above, but I am having no luck.
In the ashx pageCode:<!-- START ashx pages --> <object id="gencsvSession" type="Spring.Web.Services.WebServiceExporter, Spring.Web"> <property name="TargetName" value="gencsv"/> <property name="MemberAttributes"> <dictionary> <entry key="*"> <!-- '*' for all methods or use the method name : <entry key="submitTest"> --> <object type="System.Web.Services.WebMethodAttribute, System.Web.Services"> <property name="EnableSession" value="true"/> </object> </entry> </dictionary> </property> </object> <object name="gencsv" type="Tissuebank.gencsv, Tissuebank"> <property name="TBCPRSampleBLL" ref="TBCPRSampleBLL"></property> <property name="UserBLL" ref="UserBLL"></property> </object> <!-- END of ashx pages -->
Method that accesses the sessionCode:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.SessionState; using spring.pxl.Domain; using BusinessLayer; using log4net;
and I get the following errorCode:private void _canViewPage(HttpContext context) { logger.Debug(writeerror.rs_logmethodLM()); string a = Convert.ToString(context.Session["uid"]);
Code:Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 107: { Line 108: logger.Debug(writeerror.rs_logmethodLM()); Line 109: string a = Convert.ToString(context.Session["uid"]); Source File: ..\gencsv.ashx.cs Line: 109 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Tissuebank.gencsv._canViewPage() in ..\gencsv.ashx.cs:109 Tissuebank.gencsv.ProcessRequest(HttpContext context) in ..\gencsv.ashx.cs:37 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Reply With Quote
