Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Master Pages and service reference

Reply
Thread Tools

Master Pages and service reference

 
 
Alex
Guest
Posts: n/a
 
      06-04-2009
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


 
Reply With Quote
 
 
 
 
Tanzim Saqib
Guest
Posts: n/a
 
      07-08-2009
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


 
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
VB Master-Details Edit (Separate Pages), Response Redirect to Master Page Databinding Issue... Sam ASP .Net 0 07-20-2006 02:31 AM
Cross Page Post Back When Using Mixture of Master Pages and Non-Master Pages Jason@webbit.com ASP .Net 1 05-16-2006 02:00 PM
Master Pages Great! But what about Master User Controls? Electrified Research ASP .Net 5 10-11-2005 02:32 PM
ASP.NET 2.0: master pages and web user controls: reference to a non-shared member requires an object reference bminder ASP .Net 0 06-24-2005 12:22 AM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57