.comment-link {margin-left:.6em;}
Marc Boizeau's blog
Tuesday, August 30, 2005
  .net webservice session
Maybe it is obvious but I've seen the question on a forum;
Q:"How to make the session collection work for a .net webservice like for asp.net? "

A:"Just put the following before the web method:"
[ WebMethod(Description="Desc",EnableSession=true)]

thats all folks!

hope this helps.

comments are welcome


Ok I've posted this a few time ago. And it still works. But, the session collection is not a real session objectin this case. It is instanciate just before the web method call, but I never seen when it is uninstanciate. For instance the "end_session" event never fire!
Also, I experiment troubles while debuging an object stored in this collection for a web method.
So, use this the least you can and do not expect this to be a good equivalent to the session collection in classical ASP .Net.
 
Monday, August 29, 2005
  Winform, Web Services & credential
Just a tip today.

Last week I built a web service based application which needs a windows authentication.
The schema was:
A winform client
A group of IIS web services.
An oracle database (as alway on this blog lol)

How could the winform client say to the web services. "Hey i'm a member of this windows network, my login is Jdoe, trust me"

Ok, first I asked my favourite web administrator to configure my IIS application to not allow anonymous users. Exactly like for a classical ASPX application.

Then I changed my web.config file, puting the line :
<authentication mode="Windows" />

Ok IIS was then fine to authenticate users.
but my Winform webservice client wasn't ready yet.

In order to be "windowsly" authenticate a webservice client need to send credentials to the server.
The .net framework provide a secure and elegant way to to that:


using System;
using System.Net;
....

MyService.MyWebMethod ws = new MyService.MyWebMethod();
ws.Credentials = CredentialCache.DefaultCredentials;
...


and it works !
I was then able to retrieve informations about my connected users. For instance
the login :

...
strlogin = user.identity.name
...


that's all folks!
hope this helps!
Comments are welcome!
 
Friday, August 19, 2005
  back to work
Hello everybody

I'm back to work! I didn't post these last three weeks because I was
here and also there ,I also went to this place .
 
You are a developer and work with Oracle and Microsoft technologies? Have a look!
ATOM
How to:
Use updatable views in Access
Get data in Excel from Oracle 1
Get data in Excel from Oracle 2
Draw the Mandelbrot set using C#
Use the "Grouping Sets" SQl Syntax
Use the "Rollup" SQl Syntax
Use the "Rank over" SQl Syntax

Go to wordpress
When does the next bus pass?
Thanks
googled2cd966929769ab9
two lines in the datagrid header
Context saving with persistent datasets
.net webservice session
Winform, Web Services & credential
back to work
self description
ARCHIVES
October 2004 / November 2004 / December 2004 / January 2005 / February 2005 / March 2005 / April 2005 / June 2005 / August 2005 / September 2005 / December 2005 / February 2006 / December 2006 / March 2009 /


Powered by Blogger

mboizeau.free.fr