Re: CredientialCache.DefaultCredentials Problem

From: Paul Cheevers (paul_at_nospamaimware.com)
Date: 09/06/04


Date: Mon, 6 Sep 2004 11:59:04 +0100

Bob,

Thanks for the reply. I've managed to sort the problem out. I had my browser
set to Prompt for Username and Password, when I set it to Automatically
Logon the CredentialCache.DefaultCredentials works fine!

Cheers,
Paul

"Bob Mixon" <bob.mixon@vixcorp.com> wrote in message
news:O37chglkEHA.3452@TK2MSFTNGP15.phx.gbl...
> Paul,
>
> If your intentions are to obtain the current user information from within
> your Web Part, I would suggest using the SharePoint Object Model. The
code
> to retrieve the current user is as follows:
>
> SPWeb thisWeb = SPControl.GetContextWeb( Context );
> SPUser currentUser = thisWeb.CurrentUser;
>
> I would suggest downloading the SharePoint SDK. It has complete
> documentation of the SharePoint Object Model.
>
> ------------------------
> Bob Mixon
> http://attunesystems.mywsssite.com
>
> Do You Collaborate?
>
>
> "Paul Cheevers" <paul@nospamaimware.com> wrote in message
> news:#FUC#gckEHA.3944@tk2msftngp13.phx.gbl...
> > Hi,
> >
> > I'm having a problem using CredentialCache.DefaultCredentials in my C#
> code.
> > I'm developing a C# webpart for WSS on Windows 2003.
> >
> > My site does not allow anonymous access and I've also switched it off
for
> > the Default Web Site in IIS. When I navigate to the dashboard the
webpart
> is
> > on I get prompted for my username and password so this suggests that
this
> is
> > working.
> >
> > However when I try and use the above method to get the credentials of
the
> > current user I get a 401 exception. I've debugged the code thru Visual
> > Studio and have added a watch to the method. The object always remains
> > blank.
> >
> > If I look at whats stored in Page.User.Identity I get what the current
> users
> > information? So why isn't the CredentialCache method working?
> >
> > I've tried my code by supplying a hard-coded UserName and Password and
it
> > works fine so its only this method thats breaking.
> >
> > Have I missed something in my code/configuration?
> > Any help would be greatly appreciated.
> >
> > Cheers,
> > Paul
> >
> >
>
>


Loading