Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
The request failed with HTTP status 401: Unauthorized.
sbeach
Hello all,
I'm trying to create an integration web service to call the MediaBinWebService API, but every method always returns the following error.
Is PROFLOWERS\svc_dam an admin? False -- System.Net.WebException: The request failed with HTTP status 401: Unauthorized. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at sddamapp01.MediaBinServer.IsAdministrator() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mediabinintegration\a5f99e6b\72626c82\App_WebReferences.wamu1zp_.0.cs:line 1063 at MBIntegrationService.IsAdmin() in c:\Inetpub\wwwroot\MediaBinIntegration\App_Code\MBIntegrationService.cs:line 35
Here is a snipit of my code...
[WebMethod]
public string IsAdmin()
{
MediaBinServer mediaBinServer = new MediaBinServer();
bool isAdmin = false;
try
{
isAdmin = mediaBinServer.IsAdministrator();
}
catch(Exception e)
{
string name = WindowsIdentity.GetCurrent().Name;
string error = "Is " + name + " an admin? " + isAdmin + " -- "+ e.ToString();
return error.ToString();
}
return isAdmin.ToString();
}
Any ideas on what I could to resolve this?
Thanks,
--Steffen
Find more posts tagged with
Comments
sbeach
Never mind, I figured it out.
MediaBinServer mediaBinServer = new MediaBinServer();
mediaBinServer.Credentials = new System.Net.NetworkCredential("username", "password");
A little authentication goes a long way...
Strange that it didn't like the user identity of the AppPool. Any ideas about that?