Let Your .local Users Log Into Outlook Web App 2010 By Using Their Email Addresses

[ 17 ] Comments
Share

I’m sure that the .local Top Level Domain (TLD) must be by far the most commonly used domain name out there. And all users in a .local TLD will have a User Principal Name (UPN) in the form username@domain.local. It’s quite common for users to forget it, though, and try to use their email addresses (e.g. username@domain.com) in circumstances where they should actually be using their UPN. Often, you will hear of people trying to log into OWA by using their email address, and being denied access. Because, of course, IIS is looking for the UPN.

What I have described here is a little modification (made at your own risk) to the OWA 2010 Forms-Based Authentication (FBA) logon page that will automatically change the domain.local to domain.com (or domain.org, or domain.co.uk, or whatever you wish). To make the change, locate the logon.aspx file in your

C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\Owa\auth

folder. Before doing anything else, make a backup copy.

Open the file in Notepad, and search (CTRL-F) for the text <form

You should find it at the start of a very long line that begins like this (I’m only showing the beginning):

<form action=”/owa/auth.owa” method=”POST” name=”logonForm” ENCTYPE=”…

The first change to make is to add an onsubmit attribute, like this:

<form onsubmit=”checkDomain()” action=”/owa/auth.owa” method=”POST” name=”…

Then, just before this, on the previous line, insert the following text:

<script type=”text/javascript”>
function checkDomain()
{
var x = document.getElementById(“username”);
var y = x.value;
y = y.toLowerCase();
y = y.replace(“@yourdomain.local”, “@yourdomain.com”);
x.value = y;
}
</script>

Of course, you will need to supply your own domain names in the appropriate place.

Save the file back, and you’re finished.

Please remember – like all OWA mods, there is every chance it will be lost when you apply a service pack or rollup, since the files tend to get replaced with newer version. You will need to check that the changes are still there.


17 Responses to Let Your .local Users Log Into Outlook Web App 2010 By Using Their Email Addresses

  1. Rodrigo says:

    Hello, I use remote access by windows server 2012 r2, please can you help me? I need do logon with my UPN @mydomain.com.br, but I´m with a issue. My logon.aspx is:

    //<![CDATA[
    try {
    Sys.Net.WebRequestManager.add_invokingRequest(addCanaryToken);
    }
    catch (e) { }

    function addCanaryToken(sender, networkRequestEventArgs) {
    try {
    var headers = networkRequestEventArgs.get_webRequest().get_headers();
    var tokenName = ;
    if (!headers[tokenName])
    headers[tokenName] = ;
    }
    catch (e) { }
    }
    //]]>

    Thank you,

    best regards,

    Rodrigo

  2. Rodrigo says:

    It´s Complete

    //<![CDATA[
    try {
    Sys.Net.WebRequestManager.add_invokingRequest(addCanaryToken);
    }
    catch (e) { }

    function addCanaryToken(sender, networkRequestEventArgs) {
    try {
    var headers = networkRequestEventArgs.get_webRequest().get_headers();
    var tokenName = ;
    if (!headers[tokenName])
    headers[tokenName] = ;
    }
    catch (e) { }
    }
    //]]>

    • admin says:

      Hello. When you say “it’s complete”, do you mean to say that the code you pasted is all that there is in your OWA logon.aspx file? There should be much more than that.

  3. Rodrigo says:

    How can I send you this file?

    • admin says:

      I got it, thanks. Looking at it in Notepad, there’s a lot of code in there. But it doesn’t look like the OWA 2010 logon.aspx file. Is it from an ISA server or a Forefront server?

  4. Rodrigo says:

    No, it´s Remote.mycompany.com.br.

    I need that users can do logon with UPN name.
    my domain is mydomain.local and my UPN is @mydomain.com.br

    • admin says:

      Which folder on the server did you find the file in? I still don’t know what it is. My article was for Outlook Web Access logon, but this isn’t the Outlook Web Access logon file.

  5. Rodrigo says:

    This file is remote access essentials role windows server 2012 r2. path: C:\Program Files\Windows Server\Bin\WebApps\RemoteAccess\AccountPage

    • admin says:

      Okay, I did a quick search, and it looks like that’s for something called SBS2011 Remote Web Access. That’s not the same thing is Outlook Web Access. It might still be possible to make changes to it, although I wouldn’t be able to test the changes at this end (because I don’t have SBS2011). Do you still want to try?

  6. Rodrigo says:

    Can you help me?

    If not, please, can you delete my posts?

  7. Rodrigo says:

    ok thank you, please, delete my address post

    • admin says:

      Okay, I edited the post with the domain in, but please look to see if I missed it anywhere.

      Anyway, I had a look at the logon.aspx file. If you want to try some changes, I’ll make some suggestions. Make a copy of your existing logon.aspx file first, though. Remember to put your own domain in after pasting the code. I’m not 100% sure of the ID of the user name input box, so you might need to check your browser’s source view to get its name if this code doesn’t work first time.

      Look for the line that starts like this
      <form id="formLogon"

      Change the beginnging to
      <form onsubmit=”checkDomain()" id="formLogon"

      Insert the following code before that line you just changed


      <script type=”text/javascript”>
      function checkDomain()
      {
      var x = document.getElementById(“UserNameText”);
      var y = x.value;
      y = y.toLowerCase();
      y = y.replace(“@yourdomain.local”, “@yourdomain.com.br”);
      x.value = y;
      }
      </script>

      I think that should be it. If it doesn’t work, email me the file at email@leederbyshire.com , and I’ll take a look.

    • admin says:

      I got your email, but my reply to you didn’t get delivered. I got this message below instead. But no matter, I will paste my reply to you here:

      Can you go to the log on page in your browser, and before trying to log in, can you look at the page source. If you are using IE, this would be on the View menu. If you don’t see a View menu item, you’ll need to right-click the browser menu somewhere and make sure that the Menu bar is enabled. When you can see the page source, can you save it to a file and send it to me please?

      Here is part of the error message I got when I tried to reply:

      —–

      BY2FFO11FD017.mail.protection.outlook.com gave this error:
      Service unavailable; Client host [81.168.104.129] blocked using FBLW15; To request removal from this list please forward this message to delist@messaging.microsoft.com

      Your message wasn’t delivered due to a permission or security issue. It may have been rejected by a moderator, the address may only accept e-mail from certain senders, or another restriction may be preventing delivery.

  8. Rodrigo says:

    i sent you new e-mail.

    • admin says:

      Okay, I think I found the answer, and sent you a new file to try. In case you don’t get it, the problem is caused by WordPress trying to be too clever and taking all the simple double-quotes that I put into the code, and replacing them with fancy left and right ones. JavaScript doesn’t like them at all.




Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>