Ich möchte Sie um Hilfe für den folgenden Code bitten, den ich schnell geschrieben habe, da ich immer "403 FORBIDDEN" erhalte.
HttpWebRequest pozadavek = (HttpWebRequest)WebRequest.Create("LINK THAT ASKS FOR AUTHLOGIN"); //https
System.IO.StreamReader stream = null;
System.String result = null;
public Form1()
{
InitializeComponent();
pozadavek.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequested;
pozadavek.Credentials = new NetworkCredential("NAME", "PASS");
pozadavek.PreAuthenticate = true;
}
private void Form1_Load(object sender, EventArgs e)
{
WebResponse webresponse = pozadavek.GetResponse(); //throws an exception:403 forbidden
stream = new System.IO.StreamReader(webresponse.GetResponseStream());
result = stream.ReadToEnd();
this.webBrowser1.DocumentText = result;
}