HOWTO: Automatically Login to OWA 2007 using HTML + JavaScript
First thing first, you should understand that this is NOT SUPPORTED & NOT RECOMMENDED solution by Microsoft.
This is just a proof of concept that OWA 2007 can be auto login, if you know the username & password of target account.
The approach is simple and took me little reverse engineering or OWA’s login page. Owa login page being HTML does a form submit and post the username/password along with few hidden variables and upon receiving those parameters owaauth.dll generate a cookie, assign it to the session and redirect you to your mailbox. How easy, you may say.. but how you can submit those parameters programmatically.
This is how its done…
<script>
function LoginToOWA (server,domain,username,password) {
var url = "https://" + server + "/exchweb/bin/auth/owaauth.dll";
var p = {destination:'https://' + server + '/exchange',flags:'0',forcedownlevel:'0',trusted:'0',isutf8:'1',username:domain + '\\' + username,password:password};
var myForm = document.createElement("form");
myForm.method="post" ;
myForm.action = url ;
for (var k in p) {
var myInput = document.createElement("input") ;
myInput.setAttribute("name", k) ;
myInput.setAttribute("value", p[k]);
myForm.appendChild(myInput) ;
}
document.body.appendChild(myForm) ;
myForm.submit() ;
document.body.removeChild(myForm) ;
}
</script>
<body onload="javascript:LoginToOWA('owa.exchange.com','domain','username','password');">
<h3>Please wait while redirecting to OWA...</h3>
</Body>
Happy Coding!!!
Share this post : |
Comments
Anonymous
June 02, 2009
PingBack from http://asp-net-hosting.simplynetdev.com/howto-automatically-login-to-owa-2007-using-html-javascript/Anonymous
November 18, 2009
The comment has been removedAnonymous
February 02, 2010
Hi, I'm able to use mentioned script. Is it possible the send emails with same link. appreciated if replied quicklyAnonymous
February 15, 2010
hi Is it possible send the emails from above code. If yes how couldAnonymous
February 16, 2010
Thanks, I tried your solution, however it is still redirecting me again to the log in page. any ideas?Anonymous
March 15, 2010
Thanks, this code works fine for me. For OWA 2010 replace the dll path: /exchweb/bin/auth/owaauth.dll with this: /owa/auth/owaauth.dll Note: OWA 2010 support mailbox selection from the URL, for example: https://owaserver/owa/mailbox@domain.tld/Anonymous
July 20, 2010
The comment has been removedAnonymous
July 21, 2010
The comment has been removedAnonymous
October 27, 2010
Hi, Thanks for the code, seems this is the only source. I am using OWA 2010 it works with the minor tweak "Tiziano Sartori" suggested. But when i change to IE8 from IE6, it does not work anymore. Any suggestions ?Anonymous
July 25, 2011
it does not work if password includes single quote or double quote, is there anyway to fix???Anonymous
August 19, 2011
You, sir, have made my week! Awesome, awesome, awesome.