2011-05-22 68 views
3

我有一個outlook web郵件登錄頁面,其中有一個用戶名和密碼字段,允許您輸入到您的收件箱,這是由我的網站提供的託管公司。在網站上創建電子郵件的登錄表單,asp.net

我需要一種方法將這些字段放在我的主網站(由asp.net mvc驅動),然後使用輸入的憑據將用戶重定向到他的電子郵件收件箱?

這怎麼可能(當然是安全的)?

我想這是從原來的站點複製下面的HTML代碼:

<html> 
<body> 
<form autocomplete="off" name="logonForm" method="POST" action="https://mail.moda.gov.sa/OWA/owaauth.dll"> 
<input type="hidden" value="https://mail.moda.gov.sa/OWA/" name="destination"> 
<input type="hidden" value="4" name="flags"> 
<input type="hidden" value="0" name="forcedownlevel"> 
<table cellspacing="0" cellpadding="0" align="center" id="tblMain"> 
    <tbody><tr> 
     <td colspan="3"> 
      <table cellspacing="0" cellpadding="0" class="tblLgn"> 
      <tbody><tr> 
       <td class="lgnTL"><img alt="" src="/owa/8.2.247.2/themes/base/lgntopl.gif"></td> 
       <td class="lgnTM"></td> 
       <td class="lgnTR"><img alt="" src="/owa/8.2.247.2/themes/base/lgntopr.gif"></td> 
      </tr> 
      </tbody></table> 
     </td> 
    </tr> 
    <tr> 
     <td id="mdLft">&nbsp;</td> 
     <td id="mdMid"> 
      <table class="mid" id="tblMid"> 
       <tbody><tr> 
        <td class="expl" id="expltxt"> 

        </td> 
       </tr> 
       <tr><td><hr></td></tr> 
       <tr> 
        <td> 
         <table class="nonMSIE"> 
         <colgroup><col> 
         <col class="w100"> 
         </colgroup><tbody><tr id="trSec"> 
          <td colspan="2">         
           Security 
            &lrm;(
            <a onclick="clkExp('lnkShwSec')" id="lnkShwSec" href="#"> 
            show explanation 
            </a> 
            <a style="display:none" onclick="clkExp('lnkHdSec')" id="lnkHdSec" href="#"> 
            hide explanation 
            </a> 
           )&lrm; 
          </td> 
         </tr>      
         <tr> 
          <td><input type="radio" checked="" onclick="clkSec()" class="rdo" value="0" name="trusted" id="rdoPblc"></td> 
          <td><label for="rdoPblc">This is a public or shared computer</label></td> 
         </tr> 
         <tr style="display:none" class="expl" id="trPubExp"> 
          <td></td> 
          <td>Select this option if you use Outlook Web Access on a public computer. Be sure to log off when you have finished using Outlook Web Access and close all windows to end your session.</td> 
         </tr> 
         <tr> 
          <td><input type="radio" onclick="clkSec()" class="rdo" value="4" name="trusted" id="rdoPrvt"></td> 
          <td><label for="rdoPrvt">This is a private computer</label></td> 
         </tr> 
         <tr style="display:none" class="expl" id="trPrvtExp"> 
          <td></td> 
          <td>Select this option if you are the only person who uses this computer. Your server will allow a longer period of inactivity before logging you off.</td> 
         </tr> 
         <tr style="" class="wrng" id="trPrvtWrn"> 
          <td></td> 
          <td>Warning: By selecting this option, you confirm that this computer complies with your organization's security policy.</td> 
         </tr> 
         </tbody></table> 
        </td> 
       </tr> 
       <tr><td><hr></td></tr> 
       <tr> 
        <td> 
         <table class="nonMSIE"> 
          <colgroup><col> 
          <col class="w100"> 

           </colgroup><tbody><tr> 
            <td><input type="checkbox" checked="" disabled="" onclick="clkBsc();" class="rdo" id="chkBsc"></td> 
            <td nowrap=""><label for="chkBsc">Use Outlook Web Access Light</label></td> 
           </tr> 
           <tr class="disBsc" id="trBscExp"> 
            <td></td> 
            <td>The Light client provides fewer features and is sometimes faster. Use the Light client if you are on a slow connection or using a computer with unusually strict browser security settings. If you are using a browser other than Internet Explorer 6 or later, you can only use the Light client.</td> 
          </tr> 

         </tbody></table> 
        </td> 
       </tr> 
       <tr><td><hr></td></tr> 
       <tr> 
        <td> 
         <table class="nonMSIE"> 
          <colgroup><col class="nowrap"> 
          <col class="w100"> 
          <col> 
          </colgroup><tbody><tr> 
           <td nowrap=""><label for="username">User name:</label></td> 
           <td class="txtpad"><input type="text" class="txt" name="username" id="username"></td> 
          </tr> 
          <tr> 
           <td nowrap=""><label for="password">Password:</label></td> 
           <td class="txtpad"><input type="password" onfocus="g_fFcs=0" class="txt" name="password" id="password"></td> 
          </tr> 
          <tr> 
           <td align="right" class="txtpad" colspan="2"> 

            <input type="submit" onclick="clkLgn()" value="Log On" class="btn"> 

            <input type="hidden" value="1" name="isUtf8"> 
           </td> 
          </tr> 
         </tbody></table> 
        </td> 
       </tr> 
       <tr><td><hr></td></tr> 

        <tr class="wrng" id="trInvCrd"> 
        <td>The user name or password that you entered is not valid. Try entering it again.</td> 
       </tr> 

      </tbody></table> 
      <table style="display:none" class="mid" id="tblMid2"> 
       <tbody><tr><td><hr></td></tr> 
       <tr> 
        <td><br>Please enable cookies for this web site.<br><br>Cookies are currently disabled by your browser. Outlook Web Access requires that cookies be enabled. <br><br>If you are using Microsoft Internet Explorer 6 or later, open Internet Options from the Tools menu. Click the Privacy tab, and then click Sites. Type the address for Outlook Web Access into the field, click Allow, and then click OK to save your changes.<br><br><br></td> 
       </tr> 
       <tr><td><hr></td></tr> 
       <tr> 
        <td align="right" class="txtpad"> 

         <input type="button" onclick="clkRtry()" value="Retry" style="float: right" class="btn"> 

        </td> 
       </tr> 
      </tbody></table> 
      <table class="mid tblConn"> 
       <tbody><tr> 
        <td align="right" class="tdConnImg" rowspan="2"><img alt="" src="/owa/8.2.247.2/themes/base/lgnexlogo.gif" style="vertical-align:top"></td> 
        <td class="tdConn">Connected to Microsoft Exchange</td> 
       </tr> 
       <tr> 
        <td class="tdCopy">&copy; 2007 Microsoft Corporation. All rights reserved. </td> 
       </tr> 
      </tbody></table> 
     </td> 
     <td id="mdRt">&nbsp;</td> 
    </tr> 
    <tr> 
     <td colspan="3"> 
      <table cellspacing="0" cellpadding="0" class="tblLgn"> 
      <tbody><tr> 
       <td class="lgnBL"><img alt="" src="/owa/8.2.247.2/themes/base/lgnbotl.gif"></td> 
       <td class="lgnBM"></td> 
       <td class="lgnBR"><img alt="" src="/owa/8.2.247.2/themes/base/lgnbotr.gif"></td> 
      </tr> 
      </tbody></table> 
     </td> 
    </tr> 
</tbody></table> 
</form> 
</body> 
</html> 

回答

2

你可以嘗試反向工程HTML的形式,用於登錄到您的收件箱。如果您在網站上創建完全相同的表單,則可能會起作用。 但是,它不能保證工作,網站可能會檢查引用者或使用其他校驗和來查看HTTP POST的來源。

[編輯後,被賦予更多信息] 兩個備註:

1)也許這篇文章可以幫助你:Sending an OWA logon form from Java

2)儘量使用Fiddler和兩個請求(官方一個和你比較)。看看是否有任何參數丟失。您是否複製了所有JavaScript等等。

+0

我試過了,但沒有成功。 – 2011-05-23 20:12:22

+0

您將不得不提供更多信息。你嘗試了什麼。請擴大您的問題。 – 2011-05-26 18:47:02

+0

我已經添加了更多信息。 – 2011-05-29 14:57:44

4

這是行不通的嗎?

<form action="https://mail.moda.gov.sa/OWA/auth/owaauth.dll" method="POST" name="logonForm" autocomplete="off"> 
    <input name="destination" value="https://mail.moda.gov.sa/OWA/" type="hidden"> 
    <input name="flags" value="0" type="hidden"> 
    <input name="forcedownlevel" value="0" type="hidden"> 

    <input id="rdoPblc" name="trusted" value="0" class="rdo" checked="checked" type="radio"> 
    <label for="rdoPblc">This is a public or shared computer</label><br /> 
    <input id="rdoPrvt" name="trusted" value="4" class="rdo" type="radio"> 
    <label for="rdoPrvt">This is a private computer</label><br /><br /> 

    <input id="chkBsc" class="rdo" checked="checked" type="checkbox"></td> 
    <label for="chkBsc">Use Outlook Web Access Light</label><br /><br /> 

    <label for="username">User name:</label> 
    <input id="username" name="username" class="txt" type="text"><br /> 
    <label for="password">Password:</label> 
    <input id="password" name="password" class="txt" type="password"><br /> 
    <input class="btn" value="Log On" type="submit"> 
    <input name="isUtf8" value="1" type="hidden"> 
</form> 

只要您的網站是值得信賴的,它應該是安全的。

0

一個簡單的方法可能是在您的網站上有一個鏈接到收件箱登錄頁面的iFrame,但是我想你已經考慮過了。

我在這裏猜測,但也許你有一個網站,用戶登錄到。但是,您在另一個網站上託管他們的電子郵件,但您不希望他們必須登錄兩次才能訪問他們的電子郵件。

Michiel提出了一個很好的觀點,即網站可能會檢查HTTP Post是從哪裏來的。如果他們檢查,那麼你必須和他們說話。也許他們可以將您添加到批准的URL列表中。

+0

你是對的,我已經考慮使用iFrame,但我想定製登錄表單的外觀,這是無法使用iFrame完成的。 – 2011-06-04 09:24:05

相關問題