T
THTB
I've got a web service that I'm running on IIS 5.1 on my local machine.
Using .Net 2.0.
IIS Authentication access is Basic and I'm using a local user.
I've created a windows application that can successfully access the web
service using the following code:
xTSMApplication.cApplication cApplication = new
xTSMApplication.cApplication();
// Set credentials
NetworkCredential Credential = new NetworkCredential();
Credential.UserName = "AppUser";
Credential.Password = "App123";
Credential.Domain = "MyDomain";
CredentialCache CredCache = new CredentialCache();
CredCache.Add(new Uri(cApplication.Url), "Basic", Credential);
cApplication.Credentials = CredCache;
// Call the Web Service
xTSMApplication.AppResponse oAppResponse =
cApplication.SaveApplication(App);
However, when I create a class library (DLL) to access the web service using
the same basic code (see below), I get an "401: Access Denied" exception.
I've got a windows application that calls a method in my DLL. Please help!
code from my DLL:
public xTSMApplication.AppResponse SaveApp(xTSMApplication.NewApplication App)
{
xTSMApplication.cApplication cApplication = new
xTSMApplication.cApplication();
// Set credentials
NetworkCredential Credential = new NetworkCredential();
Credential.UserName = "AppUser";
Credential.Password = "App123";
Credential.Domain = "MyDomain";
CredentialCache CredCache = new CredentialCache();
CredCache.Add(new Uri(cApplication.Url), "Basic", Credential);
cApplication.Credentials = CredCache;
xTSMApplication.AppResponse oAppResponse =
cApplication.SaveApplication(App);
return oAppResponse;
}
Thanks for your help,
Tom
Using .Net 2.0.
IIS Authentication access is Basic and I'm using a local user.
I've created a windows application that can successfully access the web
service using the following code:
xTSMApplication.cApplication cApplication = new
xTSMApplication.cApplication();
// Set credentials
NetworkCredential Credential = new NetworkCredential();
Credential.UserName = "AppUser";
Credential.Password = "App123";
Credential.Domain = "MyDomain";
CredentialCache CredCache = new CredentialCache();
CredCache.Add(new Uri(cApplication.Url), "Basic", Credential);
cApplication.Credentials = CredCache;
// Call the Web Service
xTSMApplication.AppResponse oAppResponse =
cApplication.SaveApplication(App);
However, when I create a class library (DLL) to access the web service using
the same basic code (see below), I get an "401: Access Denied" exception.
I've got a windows application that calls a method in my DLL. Please help!
code from my DLL:
public xTSMApplication.AppResponse SaveApp(xTSMApplication.NewApplication App)
{
xTSMApplication.cApplication cApplication = new
xTSMApplication.cApplication();
// Set credentials
NetworkCredential Credential = new NetworkCredential();
Credential.UserName = "AppUser";
Credential.Password = "App123";
Credential.Domain = "MyDomain";
CredentialCache CredCache = new CredentialCache();
CredCache.Add(new Uri(cApplication.Url), "Basic", Credential);
cApplication.Credentials = CredCache;
xTSMApplication.AppResponse oAppResponse =
cApplication.SaveApplication(App);
return oAppResponse;
}
Thanks for your help,
Tom