Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Get DefaultCredentials of one web app into another?

Reply
Thread Tools

Get DefaultCredentials of one web app into another?

 
 
Simon Storr
Guest
Posts: n/a
 
      04-08-2004
We have a web app which links to another ASP.NET web application (namely the
Microsoft CRM). Our app is launched in a new browser window from a link in
the CRM. Our app is on the same server inside the same IIS site. Both are
using Windows Authentication.

Basically we are tearing our hair out trying to get the credentials (or at
least the user name) of the current user in the CRM so we can pass it into
our app. Is this in any way possible?!

Thanks in advance,

Simon


 
Reply With Quote
 
 
 
 
[MSFT]
Guest
Posts: n/a
 
      04-09-2004
Hi Simon,

You may get the user identity in ASP.NET application from following string:

context.User.Identity.Name()

This requires "anonymous access" is disabled on the virtual folder.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
 
fur face
Guest
Posts: n/a
 
      04-20-2004
hi Luke,

I tried that but it just gives the currently logged in Windows user - not
the user authenticated to the CRM.

Simon.

"[MSFT]" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi Simon,
>
> You may get the user identity in ASP.NET application from following

string:
>
> context.User.Identity.Name()
>
> This requires "anonymous access" is disabled on the virtual folder.
>
> Luke
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>



 
Reply With Quote
 
[MSFT]
Guest
Posts: n/a
 
      04-21-2004
Hi Simon,

Sorry, I may misunderstand your question. For account in Windows CRM, we
cannot retrieve it simply in ASP.NET. You need Microsoft CRM SDK

http://msdn.microsoft.com/library/de...us/CrmSdk/htm/
default.asp

You may download it first anc check the sample code in it.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
fur face
Guest
Posts: n/a
 
      04-21-2004
Luke,

Thanks, I already have the SDK. Here's the code I'm trying to use which is
based on the 'create a user' example in there -

using System;
using System.Net;
using Microsoft.CRM.Proxy;

private Uri FUri;
private string FServiceDir;
..
..
..

private CUserAuth GetBizUser(BizUser aBizUser)
{
// log in
aBizUser.Credentials = CredentialCache.DefaultCredentials; // Always
blank...?
aBizUser.Url = FServiceDir + "BizUser.srf";
CUserAuth lAuth;
try
{
lAuth = aBizUser.WhoAmI();
return lAuth;
}
catch (Exception ex)
{
throw new Exception("User could not be validated. E:"+ex.Message);
}
}

// constructor
public CRMClass(string aUri)
{
string lCRMServerUrl = "http://"+aUri;
FUri = new Uri(lCRMServerUrl);
FServiceDir = lCRMServerUrl + "/MSCRMServices/";
}


GetBizUser should return the CUserAuth class which contains the user info.
The problem is DefaultCredentials just returns the first user which it
thinks is valid (which for some reason always turns out blank - anonymous
user??) NOT the user who logged into the CRM via the IE login box (always
ask for password is enabled in IE). Result - it throws the 'user could not
be validated' exception (not authorized)... I don't want the user who logged
into Windows (which all the examples I can find seem to work for).

The code is actually wrapped in a WSE web service (MSCRMWSWse), which I know
must have anonymous access, but I'm passing in the app's credentials to the
proxy instance of the service I'm using, which in turn should get passed
into the CRM SDK in my code above? -

MSCRMProxy.MSCRMWSWse lCRMWS = new myApp.MSCRMProxy.MSCRMWSWse();
lCRMWS.Credentials = FAppCredentials; // current credentials for calling app
string lName = lCRMWS.GetUserName(); // function in WS to return CRM user
name from the CUserAuth

I don't see how I can get the user who authenticated to the CRM in the first
place via the IE login box? According to the docs
CredentialCache.DefaultCredentials returns the FIRST user which is
authenticated, I can't find any way of finding a PARTICULAR user...?

Simon

"[MSFT]" <(E-Mail Removed)> wrote in message
news:eS%(E-Mail Removed)...
> Hi Simon,
>
> Sorry, I may misunderstand your question. For account in Windows CRM, we
> cannot retrieve it simply in ASP.NET. You need Microsoft CRM SDK
>
>

http://msdn.microsoft.com/library/de...us/CrmSdk/htm/
> default.asp
>
> You may download it first anc check the sample code in it.
>
> Luke
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>



 
Reply With Quote
 
[MSFT]
Guest
Posts: n/a
 
      04-22-2004
Hi Simon,

Microsoft CRM uses integrated Microsoft Windows authentication to perform
authentication. If the with Anonymous mode , it will return null anyway.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are the System.Net.CredentialCache.DefaultCredentials always empty in and ASP application? Craig ASP .Net 1 10-03-2007 01:24 PM
Web service, forms authentication and DefaultCredentials SP ASP .Net Security 0 06-27-2007 02:46 PM
1 server, 2 web sites 1 asp.net app each, build one, other -> Server App Unavailable Dave Diehl ASP .Net 4 08-11-2004 12:52 PM
How to secure one web app with another web app... Maras ASP .Net Security 0 06-17-2004 07:37 AM
Page Scraping of Authenticated pages with CredentialCache.DefaultCredentials ASP .Net 1 12-09-2003 09:59 PM



Advertisments