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 8401181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:44:23+00:00 2026-06-09T21:44:23+00:00

i want to consume a php Webservice from C# which is protected by htaccess.

  • 0

i want to consume a php Webservice from C# which is protected by htaccess.
i added the Service by adding a web reference in my VS 2010.

mywsfromwsdl myws = new mywsfromwsdl();

System.Net.CredentialCache myCredentials = new System.Net.CredentialCache();
NetworkCredential netCred = new NetworkCredential("user", "pass");
myCredentials.Add(new Uri(myws.Url), "Basic", netCred);
myws.Credentials = myCredentials;
myws.PreAuthenticate = true;

tbxIN.Text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "+
            " <test> "+
            " <parm1>4</parm1>  "+
            " <parm1>2</parm1>  "+
            "  </test>";

tbxOUT.Text= myws.func1(tbxIN.Text.ToString());

The VS shows an error called 400 Bad REquest my last row.
If i delete the .htaccess File on the server, the pgm works fine, but i cant delete. because other PHP User use the Service.

Can anybody tell me how to send the Credentials correctly ?

By jo

  • 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-09T21:44:24+00:00Added an answer on June 9, 2026 at 9:44 pm

    According to MSDN you shouldn’t need the credential cache:

     // Set the client-side credentials using the Credentials property.
     ICredentials credentials = new NetworkCredential("Joe",SecurelyStoredPassword,"mydomain");
     math.Credentials = credentials;
    

    Have you tried this method instead of the cache object? More info can be found here.

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

Sidebar

Related Questions

I want to consume WCF web service from Android application. I have worked on
I have a webservice, written in PHP, which I want to consume in a
I want to consume a web service that is running on the local machine
Can any body have idea how to consume php soap web service that have
I want to consume a json web service , this is the url :
I want to consume Java based web service with c#.net client. The problem is,
I want to consume an XML-RPC service built in PHP for my WP7 app
I'm trying to consume a hello world AXIS2 SOAP web service using a PHP
I want to consume a WCF service in a PHP script and the goal
I want to consume a webservice and show that answer in tabhost on android.How

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.