Hi, I have the following setup.
Exchange Server with Forms based authentication.
Customised owalogon.asp redirects to custom asp.net page to display
informationals to users
I am using WebDAV and .NET to authenticate the user in the asp.net.
The following are the links for exchange.
https://prepro01/exchange, which redirects when hit to this url ->
https://prepro01/exchweb/bin/auth/owalogon.asp?url=https://prepro01/exchange&reason=0.
In the custom asp.net page we do the following code:
string authURI = "https://prepro01" + "/exchweb/bin/auth/owaauth.dll";
string destination = "https://prepro01" + "/exchange/";
// Create the web request body:
// UserFullname is DOMAIN\\username
string body =
string.Format("destination={0}&username={1}&password={2}",
destination, userFullName, password);
byte[] bytes = Encoding.UTF8.GetBytes(body);
// Create the web request:
HttpWebRequest request =
(HttpWebRequest)System.Net.WebRequest.Create(authURI);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.CookieContainer = new CookieContainer();
request.ContentLength = bytes.Length;
// Create the web request content stream:
using (Stream stream = request.GetRequestStream())
{
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
try
{
// Get the response & store the authentication
cookies:
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
if (response.Cookies.Count < 2)
{
//throw new AuthenticationException("Login failed.
Is the login / password correct?");
}
//cookies = new CookieContainer();
foreach (Cookie myCookie in response.Cookies)
{
request.CookieContainer.Add(myCookie);
}
response.Close();
return true;
}
When this is run I get no cookies returned. So obviously the login is
failing. But why, I am sending to the wrong links? I have pretty much
used code from Henning Krause, but no luck. WebDAV is on in the server
with Exchange now.
Any ideas?
Thanks
Eamonn
Jenbo - 14 Jul 2008 10:26 GMT
Check out
http://www.infini-tec.de/post/2004/12/Get-the-WebDAV-url-for-an-Exchange-2000200
3-mailbox.aspx
For building the correct WebDav URL for exchange.
E