Hello, I would like to ask you for help with the following code I have quickly write, beucase I always get "403 FORBIDDEN".
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;
}