|
 |
|
อยากทราบมีใครเคยทำ Web SSO มั่งครับ และพอมีใครแนะแนวทางได้มั่ง |
|
 |
|
|
 |
 |
|
ถ้าอย่างงั้นคงจะต้องส่งพวก User ไปกับ Hidden แล้ว Action ไปยังปลายทางครับ 
|
 |
 |
 |
 |
Date :
2013-07-05 12:38:21 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอคำแนะนำต่อหน่อยค๊าบบบบ
คือหน้าแรกให้เก็บ Session ประมาณนี้
index
protected void btnLogin_Click(object sender, EventArgs e)
{
ltr_result.Text = "";
DirectoryEntry entry = new DirectoryEntry();
entry.Path = "LDAP://10.70.1.10/dc=mahidol,dc=local";
entry.Username = txtUsername.Text;
entry.Password = txtPassword.Text;
try
{
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.SearchScope = SearchScope.Subtree;
searcher.Filter = "(&(objectclass=user)(sAMAccountName=" + txtUsername.Text + "))";
SearchResult result = searcher.FindOne();
if (result != null)
{
DirectoryEntry userEntry = result.GetDirectoryEntry();
userEntry.Username = txtUsername.Text;
userEntry.Password = txtPassword.Text;
try
{
object obj = entry.NativeObject;
Session["sAMAccountName"] = txtUsername.Text;
Session["Password"] = txtPassword.Text;
Response.Redirect("Main.aspx");
}
catch (Exception ex)
{
ltr_result.Text = "<font color=\"red\">" + "Please enter your password." + "</font>";
Response.Write("authen fail");
}
}
}
catch (Exception ex)
{
}
และหน้าสองที่เป็นหน้ากลางเพื่อจะคลิกปุ่มไป App ต่อไป
Main
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Session["sAMAccountName"] == null && Session["Password"] == null)
{
Response.Redirect("index.aspx");
Response.End();
}
}
}
protected void btnMail_Click(object sender, EventArgs e)
{
.......... ใส่อะไรอะครับ .............
}
Login Mail
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="MU.OWA.Login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login OWA</title>
<asp:Literal ID="ltr_javascript" runat="server"></asp:Literal>
</head>
<body onload="javascript:owaLogin();">
<table width="100%">
<tr>
<td align="center">
<img src="../images/spacer.gif" height="80" alt="" />
</td>
</tr>
<tr>
<td align="center">
<img src="../images/loading_bar.gif" alt="" />
</td>
</tr>
<tr>
<td align="center">
<img src="../images/spacer.gif" height="30" alt="" />
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblShowNewEmail" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<img src="../Images/spacer.gif" height="10" alt="" />
</td>
</tr>
</table>
<form id="logonForm" name="logonForm" target="_self" action="<%
string Exchange_serverName = ConfigurationManager.AppSettings["Exchange_serverName_SLY"].ToString();
if (Session["Exchange_serverName"] != null)
{
Exchange_serverName = Session["Exchange_serverName"].ToString();
}
Response.Write("https://" + Exchange_serverName +
ConfigurationManager.AppSettings["Exchange_actionPath"].ToString() );
%>" method="post">
<input type="hidden" name="destination" value="<% Response.Write("https://"+Exchange_serverName+ConfigurationManager.AppSettings["Exchange_destinationPath"].ToString() );%>" />
<input type="hidden" name="username" id="Hidden1" />
<input type="hidden" name="password" id="Hidden2" />
<input type="hidden" id="Hidden3" name="SubmitCreds" value="Connection" />
<input type="hidden" id="Hidden4" name="forcedownlevel" value="0" />
<input type="hidden" id="Hidden5" name="trusted" value="0" />
<input type="hidden" name="flags" value="<%
bool isBasic = true;
if (Session["isBasicMode"] != null)
isBasic = Convert.ToBoolean(Session["isBasicMode"].ToString());
else
isBasic = Convert.ToBoolean(ConfigurationManager.AppSettings["Exchange_IsBasicMode"].ToString());
if (isBasic)
Response.Write("5");
else
Response.Write("0");
%>" />
</form>
</body>
</html>
ทำหน้า Login ให้เป็น Hidden Field แล้วอ่ะคับ
|
 |
 |
 |
 |
Date :
2013-07-08 16:26:24 |
By :
offonepoint |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|