Code based Integrated Windows Authentication



Hi All!

Windows 2003

Forgive a newbie. I am new to C#, mostly worked with perl (please, no gasps
of horror or derision!).

I have to applications that I need to integrate. One is a IIS6 based
WebServices app, the other, well, not. I was going to build an interface
between the two. I have the, call it App A -> App B part working fine. App B
being the non-webservices app.

App B -> App A requires Windows Integrated authentication. Not forms based
or basic or digest. Almost all the examples discussed in books etc all
discuss forms based.

I'd like to do two things: 1) pass user/pwd info to the web services app
and/or 2) pass currently logged in user info to the web services app using a command line program.

I've got some code that will return the token from the AD network:

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Permissions;
using System.Security.Principal;
using System.Threading;

namespace USPSD
class Program
static void Main(string[] args)

WindowsPrincipal principal =
WindowsIdentity identity = (WindowsIdentity)principal.Identity;
Console.WriteLine("Authenticated: " + identity.IsAuthenticated);
Console.WriteLine("Anonymous: " + identity.IsAnonymous);
Console.WriteLine("Token: " + identity.Token);

Does anyone have a code snippet to share that discusses how to do
authentication with a console app?

I'm using C# 2005 Express Edition by the way.

Thanks in Advance!


Ok. After a little more research it appears I need to use some code out of
the System.Web.Security namespace to pass my credientials over the network.
Is my assumption correct?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads