.comment-link {margin-left:.6em;}
Marc Boizeau's blog
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!
Comments: Post a Comment

<< Home
You are a developer and work with Oracle and Microsoft technologies? Have a look!
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

back to work
just a link
self description
A web crawler(regular expressions and httprequest...
call an Oracle stored proc with oledb .net
Updating two lines with one data adapter.
oracle functions
Quotes & parameters
October 2004 / November 2004 / December 2004 / January 2005 / February 2005 / March 2005 / April 2005 / June 2005 / July 2005 / August 2005 / September 2005 / December 2005 / February 2006 / December 2006 / March 2009 /

Powered by Blogger