About the Integrated Identity Authentication instance for moss verification by C #. net winform Program

Source: Internet
Author: User

Recently, the vsto program needs to upload documents to the moss platform. Because the website uses windows integrated authentication, you must enter a password for permission issues. This makes operations and user experience very inconvenient. After studying for a long time, I did not find a good method. Finally, I finally summed up the following methods for breaking the tie shoes, my personal understanding of the principle is to simulate IE to send verification messages for verification, you can achieve the login problem.

Note: You need to add COM references named Microsoft XML and V2.6 or later versions.

Copy codeThe Code is as follows: private void button3_Click (object sender, EventArgs e)
{

This. textBox1.Text = @ "http: // localhost/Default. aspx"; // The authenticated URL or path
This. textBox2.Text = "spsservice"; // account name
This. textBox3.Text = "Zd $1234"; // Password

MSXML2.XMLHTTP http = new MSXML2.XMLHTTP ();

Http. open ("post", this. textBox1.Text, false, this. textBox2.Text, this. textBox3.Text );
Http. send ("");
Switch (http. status)
{
Case 200:
{
MessageBox. Show ("Logon successful! ");
Break;
}
Case 401:
{
MessageBox. Show ("incorrect user name and password ");
Break;
}
Default:
{
MessageBox. Show ("connection failed, please try again ");
Break;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.