Using Web Services in C#

dmauldin
Member Posts: 37
I followed the walkthrough to start learning how to connect to web services in Nav 2009.
http://msdn.microsoft.com/en-us/library/dd355316.aspx
I typed in the code exactly as it is, but when I run it, I get a WebException was unhandled error at the
Customer[] list = service.ReadMultiple(filter.ToArray(), null, 100);
line. The error says 'The request failed with HTTP status 401: Unauthorized'.
Does anyone have an idea of what is causing this and how I can fix it?
http://msdn.microsoft.com/en-us/library/dd355316.aspx
I typed in the code exactly as it is, but when I run it, I get a WebException was unhandled error at the
Customer[] list = service.ReadMultiple(filter.ToArray(), null, 100);
line. The error says 'The request failed with HTTP status 401: Unauthorized'.
Does anyone have an idea of what is causing this and how I can fix it?
0
Comments
-
User, under which you are running the application, must have correct permissions in NAV...0
-
I gave that user super user rights and I still get the error.0
-
hi
U can Try This Code
service.UseDefaultCredentials = False;
service.Credentials = New System.Net.NetworkCredential(UserName,Password);_________________
Senior NAV Developer
Microsoft Dynamics NAV0 -
I was able to do as vedant18 suggested and it worked. But of course i don't want to hard code a username and password. We will be using web services from our web site for customers to send in info. I'd like to use service.UseDefaultCredentials = true, but I keep getting the 401 Unauthorized when it creates the customer. We setup delegation but this still isn't working. Any ideas?0
-
Hi dmauldin,
Windows Authentication on iis website ?_________________
Senior NAV Developer
Microsoft Dynamics NAV0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions