Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   Master Pages and service reference (http://www.velocityreviews.com/forums/t787903-master-pages-and-service-reference.html)

Alex 06-04-2009 03:30 PM

Master Pages and service reference
 
I created a web service in my web application that needs to update a session
variable. I call the web service from a master page using java script. My
Script Manager is defined as

<asp:ScriptManager ID="ScriptManager1" runat="server" >
<Services>
<asp:ServiceReference Path="~/Web Services/e2WS.asmx"
InlineScript="True" />
</Services>
</asp:ScriptManager>


In my webmethod, I do a simple Session["Culture"] = culture;, but I get the
following error: Object reference not set to an instance of an object.

If I pass the value to a class that inherits from System.Web.UI.Page and I
try to set the session variable, I get the following error:
Session state can only be used when enableSessionState is set to true,
either in a configuration file or in the Page directive. Please also make
sure that System.Web.SessionStateModule or a custom session state module is
included in the <configuration>\<system.web>\<httpModules> section in the
application configuration.

Now, I made sure that enableSessionState and the
System.Web.SessionStateModule is included in m,y config file, but still no
luck.

Is this something to do with the fact that the java script started off in
the master page which inherits from System.Web.UI.MasterPage?

Alex



Tanzim Saqib 07-08-2009 03:39 AM

Re: Master Pages and service reference
 
Make sure you have EnableSession = true on top of your WebMethod:

[WebMethod(EnableSession = true)]

Tanzim Saqib
W: http://TanzimSaqib.com



On Jun 4, 10:30*pm, Alex <alex_d...@adp.com.(nospam)> wrote:
> I created a web service in my web application that needs to update a session
> variable. I call the web service from a master page using java script. My
> Script Manager is defined as
>
> <asp:ScriptManager ID="ScriptManager1" runat="server" >
> * * * * * * <Services>
> * * * * * * * * <asp:ServiceReference Path="~/Web Services/e2WS.asmx"
> InlineScript="True" />
> * * * * * * </Services>
> </asp:ScriptManager>
>
> In my webmethod, I do a simple Session["Culture"] = culture;, but I getthe
> following error: Object reference not set to an instance of an object.
>
> If I pass the value to a class that inherits from System.Web.UI.Page and I
> try to set the session variable, I get the following error:
> Session state can only be used when enableSessionState is set to true,
> either in a configuration file or in the Page directive. Please also make
> sure that System.Web.SessionStateModule or a custom session state module is
> included in the <configuration>\<system.web>\<httpModules> section in the
> application configuration.
>
> Now, I made sure that enableSessionState and the
> System.Web.SessionStateModule *is included in m,y config file, but still no
> luck.
>
> Is this something to do with the fact that the java script started off in
> the master page which inherits from System.Web.UI.MasterPage?
>
> Alex




All times are GMT. The time now is 11:10 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.