none
can not contact site at specified url error in executequery RRS feed

  • Question

  • Dear all,

    Iam adding users to sp group using csom code.Iam using asp.net webapplication and the code os working fine in my local.But when i change the url and execute the code iam getting the error can not contact site.I tried by pssing credentials also no luck please help.

    Thjanks 

    Praveen

    Wednesday, January 9, 2019 8:47 AM

All replies

  • Hi Praveenrangu,

    I tested in a Asp.NET web application with Windows Authentication and used this to access a site, it works:

    Make sure the changed url is valid also.

    Here is a blog about can not contact site at specific url with CSOM code for your reference:

    Cannot contact site at specified URL

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, January 10, 2019 6:02 AM
  • Thanks for your reply.My site is configured with forms based authentication.Iam getting can not contact site eror when coming to exceute query.For windows authentication its working fine.
    Thursday, January 10, 2019 4:36 PM
  • Hi,

    For FBA Authentication, try like this:

    ClientContext ctx = new ClientContext(someSiteUrl); 
    ctx.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; 
    ctx.FormsAuthenticationLoginInfo = new 
                        FormsAuthenticationLoginInfo(myUserName, myUserPwd);
    
    //get the web 
    Web w = ctx.Web;
    
    //LOAD LISTS WITH ALL PROPERTIES 
    var lists = ctx.LoadQuery(w.Lists);
    
    //execute the query 
    ctx.ExecuteQuery();

    Using the Client Object Model with a Forms Based Auth Site in SharePoint 2010

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, January 11, 2019 9:34 AM
  • thanks for the reply.If i am passing the credentilas iam getting below error.

    Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.\r\nThe request failed with the error message.


    Friday, January 11, 2019 12:36 PM
  • Hi Praveenrangu,

    Did your Asp.NET Web application use mixed authentication, Windows and FBA ?

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, January 11, 2019 1:05 PM
  • Through the asp.net web application iam connecting to sharepoint application.Sharepoint application is fba.
    Friday, January 11, 2019 1:22 PM
  • Hi,

    For Form Based authentication, the code below is working:

            String site = "http://sharepoint/";
            ClientContext context = new ClientContext(site);
            context.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
            FormsAuthenticationLoginInfo formsAuthInfo = new FormsAuthenticationLoginInfo("MyUser", "MyPassword");
            context.FormsAuthenticationLoginInfo = formsAuthInfo;
    
            // The SharePoint web at the URL.
            Web web = context.Web;
    
            // We want to retrieve the web's properties.
            context.Load(web);
    
            // Execute the query to the server.
            context.ExecuteQuery();
    

    Make sure you are using the valid account in SQL Database and then try again.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, January 15, 2019 6:11 AM
  • Thanks for the reply i have passed credentilas with the alternate acess mapping url after that iam getting below error. server was unable to process request site is not configured for claims forms authentication sharepoint .

    Please help how to connect the site.

    Thursday, January 17, 2019 3:59 PM
  • Hi,

    FBA site's url started with "https", please check if you are using the valid url like this.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, January 22, 2019 2:17 AM