Hobby Chef

HOWTO: Automatically Login to OWA 2007 using HTML + JavaScript - Jive into Messaging world - Site Home - MSDN Blogs

HOWTO: Automatically Login to OWA 2007 using HTML + JavaScript

HOWTO: Automatically Login to OWA 2007 using HTML + JavaScript

  • Comments 11

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 :
Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post
  • PingBack from http://asp-net-hosting.simplynetdev.com/howto-automatically-login-to-owa-2007-using-html-javascript/

  • This is great, but I'm looking for a way to implement this very same thing in vb.net.

    I'd like to have two textboxes that capture input and fire this javascript (or its vb.net equivalent) to post the login to the OWA page.  Any advice?  I've looked high and low to integrate the javascript above into a vb.net aspx page with a codebehind but I've had no luck.

  • Hi, I'm able to use mentioned script.

    Is it possible the send emails with same link.

    appreciated if replied quickly

  • hi Is it possible send the emails from above code.

    If yes how could

  • Thanks,

    I tried your solution, however it is still redirecting me again to the log in page.

    any ideas?

  • 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/

  • I cant able to log in using this method any other options are available.

    i am redirecting to the logon.aspx page when page load completes

  • i cant able to redirect after login using this code. can u help me

    i wants to login directly to OWA without user authentication on user side.

  • 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 ?

  • it does not work if password includes single quote or double quote, is there anyway to fix???

  • You, sir, have made my week! Awesome, awesome, awesome.

Page 1 of 1 (11 items)