Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

.NET web application connecting to NAV Web Services (Login issue)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

Relatively new to NAV 2015, I’ve created a SharePoint Portal that connects to NAV via webservices. The below snippet is my current connection method to NAV which works well.

The dedicated NAV login account details are stored in a SharePoint List, this works fine , my question is around the approach, as I’m lead to believe using a dedicated User account is not allowed for internal users due to Multiplexing (believe it’s called).

Is there another way to connect i.e. passing a username & there web service access key?

Many Thanks.

// Calls Function from The CoreFunctions Class File to get the login details & stuff in an array

ArrayList Details = CF.NAVLoginDetails();

// The Web Service URL – Stored in SharePoint

string serviceUri = CF.NAVWebServiceURL();

//Setting up NAV Conection

DataServiceContext context = new DataServiceContext(new Uri(serviceUri));

NAV nav2 = new NAV(new Uri(serviceUri));

// Setting NAV Credentials (Username,Password,Domain

nav2.Credentials = new System.Net.NetworkCredential(Details[1].ToString(), Details[2].ToString(), Details[0].ToString());

//Query

IQueryable Invoices;

Invoices = from c in nav.TPostedSalesOrder

orderby c.Line_No ascending

select c;

//Loop through

foreach (CustomerPortal.ServiceReference1.TPostedSalesOrder Invoice in Invoices)

{

 

// Do XYZ

 

}

*This post is locked for comments

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: .NET web application connecting to NAV Web Services (Login issue)

    instead of dedicated users you could work with

    client.UseDefaultCredentials = true;

    (in your case you call the client instance nav2)

    for internal users = windows/AD accounts

    instead of using nav2.credentials = ...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans