Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8414691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:13:49+00:00 2026-06-10T01:13:49+00:00

I am developing asp.net application for sharepoint 2010. I want to access sharepoint data

  • 0

I am developing asp.net application for sharepoint 2010. I want to access sharepoint data in my asp.net application. Therefore I am using web service. The web service url starts with https. I am using the following code to access the web service.

 private void TryOutCode()
        {
            //SharepointWebApplication.ListsServiceReference.ListsSoap s;
            SharepointWebApplication.ServiceReference1.ListsSoapClient proxy = new SharepointWebApplication.ServiceReference1.ListsSoapClient();

            proxy.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
            //proxy.ClientCredentials.Windows.ClientCredential.UserName = @"anil-pc\owner";
            //proxy.ClientCredentials.Windows.ClientCredential.Password = "123";
            //proxy.ClientCredentials.Windows.AllowNtlm = true;
            //proxy.ClientCredentials.Windows.ClientCredential = new NetworkCredential("owner", "123", "anil-pc");
            proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

            //Microsoft.SharePoint.SPListItem li = new Microsoft.SharePoint.SPListItem();

            //Define the parameters for the service call
            XElement query = new XElement("Query");
            XElement queryOptions = new XElement("QueryOptions");
            XElement viewFields = new XElement("ViewFields");

            XElement result = proxy.GetListItems("PBS Internal Contacts", null, query, viewFields, null, queryOptions, null);

            //XDocument list_data = XDocument.Parse(result);

            XNamespace ns = "#RowsetSchema";

            var query1 = from x in result.Descendants()
                         where x.Name == ns + "row"
                         select new PBSInternalContacts
                         {
                             User = x.Attribute("ows_User").Value,
                             Role = x.Attribute("ows_Role").Value,
                         };

            List<PBSInternalContacts> pbsInternalContactsList = query1.ToList();
            GridView1.DataSource = pbsInternalContactsList;
            GridView1.DataBind();
        }

My web.config file is as follows

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />

    <authentication mode="Windows">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Transport">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="ListsSoap1" closeTimeout="00:01:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Transport">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="ListsSoap2" closeTimeout="00:01:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Transport">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/_vti_bin/Lists.asmx" binding="basicHttpBinding"
        bindingConfiguration="ListsSoap" contract="ListsServiceReference.ListsSoap"
        name="ListsSoap" />
      <endpoint address="https://abc.info/_vti_bin/Lists.asmx"
        binding="basicHttpBinding" bindingConfiguration="ListsSoap1"
        contract="ServiceReference1.ListsSoap" name="ListsSoap1" />
    </client>
  </system.serviceModel>
</configuration>

When I debug with the above code I am getting error ‘The HTTP request is unauthorized with client authentication scheme ‘Ntlm’. The authentication header received from the server was ‘NTLM’.’ I am getting error at the following line

XElement result = proxy.GetListItems("PBS Internal Contacts", null, query, viewFields, null, queryOptions, null);

How should I access the sharepoint web service with the username and password. Can you please provide me any code or link through which I can resolve the above issue ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:13:51+00:00Added an answer on June 10, 2026 at 1:13 am

    I have passed credentials in C# as follows.

    proxy.ClientCredentials.Windows.ClientCredential = new NetworkCredential("owner", "123", "anil-pc");
    

    Web.config file has the following setting

    <security mode="Transport">
                <transport clientCredentialType="Ntlm" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
    

    Now everything is working fine. I am able to access sharepoint list data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an ASP.NET web application using Visual Studio 2010 professional and a SQL
While developing and ASP.NET application in C# or VB using Visual Studio 2005/2008/2010 (Not
i am developing one asp.net application,i am using one gridview and bind the data
I´m developing an ASP.NET Web Application and want to use the ASP.NET Routing Engine
I'm developing ASP.net application which use web services. There are no data base connections
I am developing an ASP.NET application using Web Forms and I'm stumbling on the
I am developing an asp.net mvc application where user1 could delete data records which
I am developing an ASP.NET web application that incorporates google maps. I have an
I am developing a simple ASP.Net application on a Windows 7 x64 machine using
I am developing an asp.net application in which I want to implement the discussion

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.