Thursday, April 19, 2012

how to implement security on sharepoint 2010 web services .net

We do have a Fast Search server running within our servers. We would like to use web services to pull data from FAST search server. Here is the code block I have:

 SearchProxy.QueryService queryService = new SearchProxy.QueryService();
// Use the credentials of the user running the client application:
queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Run the QueryEx method, returning the results to a DataSet:
System.Data.DataSet queryResults = queryService.QueryEx(GetXMLString());

It is working fine in my local machine but when deploying it to the web server. It fails. The DefaultCredenticals will get my real identity in my local but in web server, it doesn't know who the user is.

It works when we provide the domain and username manually with the following syntax:

queryService.Credentials = new System.Net.NetworkCredential("username", "p@ssw0rd", "domainName");

Is there a method to obtain the user identity automatically When using get into the site via a browser?

Thanks much for your guidance...

No comments:

Post a Comment