-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: bhavesh26
Message 7 in Discussion
New Message on MumbaiUserGroup
Question Of The Day !!!! -- (07-06-2005)
Reply
Reply to Sender
Recommend
Message 5 in Discussion
From:
bhavesh26
New Message on MumbaiUserGroup
Question Of The Day !!!! -- (07-06-2005)
Reply
Reply to Sender
Recommend
Message 2 in Discussion
From:
bhavesh26
Hi All, As we all know that the nature of the HTTP protocol
is stateless.It means that each and every request of the client is to be
responded without tracking that the request is coming from the same client or
different. Similarly this is true for the Webservice invoked over HTTP.When
the request reaches the Web server, the ASP.NET runtime manages the request by
instantiating an instance of your Web service type, deserializing the SOAP
envelope XML stream, and invoking the requested method passing parameters if
applicable. A new instance of the Web service type is created for each HTTP
request targeting the service, so any information stored in data fields
contained within the type are recreated for each round trip. If you want to
persist state you must specifically enable state for the method as shown here:
[ WebMethod(EnableSession=true) ]
public object getcatalog()
{
return Session["catalog"];
} [ WebMethod(EnableSession=true) ]
public void change(object val)
{
Session["catalog"] = val;
} This will cause the ASP.NET runtime to create an HttpSessionState object
the first time a method that has session state enabled is called. Each
subsequent call to a method that has session enabled will share the same
session state object, so long as the client passes a session cookie with each
subsequent request. If the client does not pass a session cookie ASP.NET will
create a new session for each call. The client invoking the service must be
session aware, something we take for granted when we navigate Web sites with a
browser. The client proxy created for a .NET Web service includes a
CookieContainer property, and .NET provides us with CookieContainer type that
we can instantiate and assign the proxy as follows: // create cookie
container once for the duration of the session
System.Net.CookieContainer cookies = new System.Net.CookieContainer(); // each
time invoking the service, assign the same cookie container before invoking
methods
localhost.SessionService1 svc = new localhost.SessionService1();
svc.CookieContainer = cookies;
MessageBox.Show(svc.UpdateHitCounter()); When the proxy invokes the service,
it serializes the method call into a SOAP envelope, and builds an HTTP request
with appropriate headers, and posts to the endpoint URI of the Web service. The
HTTP headers will include the session cookie if one is provided here, and
that's how ASP.NET can find the right session state object to make it available
to your Web method.
regards, Bhavesh
View other groups in this category.
View other groups in this category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]