Hi all
I need to be able to parse an Outlook Inbox that is only accessable via Webmail i.e. I enter a URL ([ignore][/ignore]) and am prompted for my username and passsword.
I've been trying to even just get a screenscrape of the page returned using the System.Net.HttpWebRequest object but it is refusing to authenticate me.
I have tried using Network Credentials to pass my username and password and I have tried to add an Authorization HTTP Header but the connection is refused on both tries.
The code is as follows:
Network Credentials Method
Http Headers Method
Both of these methods fail on the wr.GetResponse().GetResponseStream()) call.
Can anyone help me with what I am doing wrong or possibly suggest a better way to do this, please?
Thanks as always
Craftor

I need to be able to parse an Outlook Inbox that is only accessable via Webmail i.e. I enter a URL ([ignore][/ignore]) and am prompted for my username and passsword.
I've been trying to even just get a screenscrape of the page returned using the System.Net.HttpWebRequest object but it is refusing to authenticate me.
I have tried using Network Credentials to pass my username and password and I have tried to add an Authorization HTTP Header but the connection is refused on both tries.
The code is as follows:
Network Credentials Method
Code:
string requestURI = "[URL unfurl="true"]http://myserver/exchange/myuser/inbox";[/URL]
System.Net.HttpWebRequest wr = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(requestURI);
wr.PreAuthenticate = true;
NetworkCredential credential = new NetworkCredential("myuser","mypassword","mydomain");
wr.Credentials = credential;
System.IO.StreamReader responseReader = new System.IO.StreamReader(wr.GetResponse().GetResponseStream());
string response = responseReader.ReadToEnd();
Http Headers Method
Code:
string requestURI = "[URL unfurl="true"]http://myserver/exchange/myuser/inbox";[/URL]
System.Net.HttpWebRequest wr = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(requestURI);
wr.Headers.Add("Authorization:myuser:mypassword");
System.IO.StreamReader responseReader = new System.IO.StreamReader(wr.GetResponse().GetResponseStream());
string response = responseReader.ReadToEnd();
Both of these methods fail on the wr.GetResponse().GetResponseStream()) call.
Can anyone help me with what I am doing wrong or possibly suggest a better way to do this, please?
Thanks as always
Craftor