Passing credentials from ASP.NET website to webservice



Hi,

I have a problem with passing the default credentials from an ASP.NET web
application residing on 1 web server(IIS) to a web service residing on
another server(IIS). Below is the complete description.

The problem statement for the double hop issue in our product Email Manager
Maintenance (EMM) is as follows:

Description: The current implementation of the EMM is that the EMM web
applications (ASP.NET) are installed on the same web server which has
Microsoft CRM (1.2/3.0) installed. The EMM web applications access the MSCRM
Web services which is part of the MS CRM server setup. This setup works fine
since both the EMM web application and the web service reside on the same IIS
server.

Problem statement: The new implementation of the EMM web application
requires that the application be installed on a separate standard Windows
2000/2003 Server having IIS 6.0.
In such a case, the EMM web application needs to communicate to the MS CRM
web service on another web server. In order to consume the web service, the
web application will pass windows credentials to the web service proxy for
authentication. The credentials to be passed have to be the default
credentials. However, this involves passing credentials across servers from
one IIS server to another IIS server. The main problem lies here as the
credentials need to “hop” across from 1 site to another. The following is the
details of the environment setup for this implementation.

Server A (Domain controller) has the following installed:
1. Windows 2003 Server
2. Microsoft CRM 1.2
3. SQL Server 2000
4. IIS 6.0
5. MSCRMServices running in IIS.
6. Active Directory
7. Exchange Server 2003

Server B (Web server) has the following installed:
1. Windows 2003 Server
2. IIS 6.0 (default website set to integrated windows authentication)
3. EMM web site is installed in this web server

Below is the code where the credentials are being passed to the MSCRM web
service proxy.

using System;
using System.Data;
using System.Net;
using System.Xml;

namespace CrmHelperClass
{
public class CrmHelperClass
{
System.Net.ICredentials userCredentials;
string crmServicesUrl;
private System.Net.ICredentials adminCredentials;
//Constructor
public CrmHelperClass(string crmServiceUrl, string adminUsername, string
adminPwd)
{
try
{
crmServiceUrl = "http://10.200.167.250:80/MSCRMServices";;
adminUsername = encrypObj.Decryptedvalue(adminUsername);
adminPwd=encrypObj.Decryptedvalue(adminPwd);
//Get the admin credentials for MS CRM
adminCredentials=new
System.Net.NetworkCredential(adminUsername,adminPwd,domainname);
//Get the User credentials
userCredentials = System.Net.CredentialCache.DefaultCredentials;
//Get the BizUser CRM proxy object
oBizUser = new Microsoft.CRM.Proxy.BizUser();
oBizUser.Credentials = userCredentials;
oBizUser.Url = crmServicesUrl + CrmHelperConstants.CRMBizUserUrl; //
BizUserUrl = BizUser.srf
//Authenticate the logged in user credentials against the CRM web service
oUserAuth = oBizUser.WhoAmI();
}
catch(System.Web.Services.SoapException err)
{
throw;
}
catch(Exception ex)
{
throw ex;
}
}

}
}

If anybody has a solution to fix the issue, it will be highly appreciated.

Cheers,
Adarsh
.



Relevant Pages

  • Re: Server Time Out
    ... could be not passing user credentials to the web service from the client. ... calling a remote server from a web server due to not being able to forward ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Pass through credentials to web service
    ... It is the double-hop' limitation of NTLM authentication. ... application server, the server cannot then use those credentials to ... >I have a client application that calls a web service. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Passing credentials from ASP.NET website to webservice
    ... I have a problem with passing the default credentials from an ASP.NET web ... The current implementation of the EMM is that the EMM web ... applications are installed on the same web server which has ... since both the EMM web application and the web service reside on the same ...
    (microsoft.public.inetserver.iis.security)
  • Re: Passing user credintials from a web page to a web service.
    ... But when the aspx code is running on a different server than the web service, ... If I have impersonate set to false, the credentials are that of the IIS server running the aspx. ... If I set impersonate to true the credentials are null. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: accessing WebService from asp.net App on load balanced Servers
    ... he found that this worked only when the webservice is on the same ... they have not network credentials. ... same server with the asp.net web app.... ... | I have an ASP.Net application that retrieves Data from a Web Service. ...
    (microsoft.public.dotnet.framework.aspnet.security)