.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 6th, 2007, 03:24 AM
sinale sinale is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 2 sinale User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 32 sec
Reputation Power: 0
Web Service authentication

Hello
I have Web Service with two functions:

[Webmethod]
public string WinAuthHelloWorld()
{
return "WA : Hello world"
}

[Webmethod]
public string BasicAuthHelloWorld()
{
return "BA : Hello world"
}

In IIS I turn on the checkboxes "Integrated windows authentication" and "Basic Authentication".
In my client application I wrote:

// Main is static
static void Main()
{
Console.Write(CallBasicAuthHelloWorld());

Console.WriteCallWinAuthHelloWorld());
}

private string CallBasicAuthHelloWorld()
{
NetworkCredential netCredential = new NetworkCredential("domainname\username", "password");
Uri uri = new Uri(service.Url);
ICredentials credentials = netCredential.GetCredential(uri, "Basic");
service.Credentials = credentials;
service.PreAuthenticate = true;


return service.BasicAuthHelloWorld();
}

private string CallWinAuthHelloWorld()
{
Uri uri = new Uri(service.Url);
service.Credentials = = System.Net.CredentialCache.DefaultCredentials;

return WinAuthHelloWorld();
}

In invocation BasicAuthHelloWorld function I got Error 401 : Unauthorized.
What I dismiss in my code?

Thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Web Service authentication


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT