Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Can't access Web Service thru DLL (but can thru Windows App)

Reply
Thread Tools

Can't access Web Service thru DLL (but can thru Windows App)

 
 
THTB
Guest
Posts: n/a
 
      05-17-2007
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

 
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
Order notes starting at C thru B rather than A thru G Max Williams Ruby 3 01-06-2009 11:37 AM
RDP thru Cisco VPN client and thru 501 Failure curttampa@gmail.com Cisco 21 08-26-2008 03:11 PM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
How to determine if a DLL is a COM DLL or .NET DLL Anushi ASP .Net 5 10-28-2004 01:59 PM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM



Advertisments