版主:
非常感謝您這麽熱情!這是我找的代碼,麻煩幫忙指點下怎麽將我需整合的網站的URL(
http://sidcess.eoxconn.com/)加入其中,謝謝!我是用ASP.net應用程式(SsoToCMMI.aspx)去調用以下程式(SsoToCMMI.aspx.cs):
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint.Portal;
using Microsoft.SharePoint.Portal.SingleSignon;
namespace FormSSO
{
public partial class SsoToCMMI : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
IntPtr pUserName = IntPtr.Zero;
IntPtr pPassword = IntPtr.Zero;
try
{
ISsoProvider isso = SsoProviderFactory.GetSsoProvider();
SsoCredentials myCreds = isso.GetCredentials("FormSSO");
pUserName = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(myCreds.UserName);
String userName = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(pUserName);
pPassword = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(myCreds.Password);
String Password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(pPassword);
}
catch (SingleSignonCredsNotFoundException ssoe)
{
if (SSOReturnCodes.SSO_E_CREDS_NOT_FOUND == ssoe.LastErrorCode)
{
string strSSOLogonFormURL = SingleSignonLocator.GetCredentialEntryUrl("FormSSO");
Response.Write(User.Identity.Name.ToString() +
"您好!<br>" + "SSO TO GMail Fail!<BR><a href=" + strSSOLogonFormURL +
" target='_self' >找不到對應的帳號,請點此連結輸入CMMI帳號及密碼!</a><P><input type='button' onclick='javascript:window.close()' value='關閉' />");
}
}
catch (SingleSignonException ex)
{
Response.Write(ex.LastErrorCode);
Response.Write(ex.Message);
}
catch (Exception exx)
{
Response.Write(exx.Message);
Response.Write(exx.InnerException);
}
finally
{
if (IntPtr.Zero != pUserName)
{
System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(pUserName);
System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(pPassword);
}
}
}
}
}
ASP.net應用程式(SsoToCMMI.aspx)的代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SsoToCMMI.aspx.cs" Inherits="FormSSO.SsoToCMMI" %>
<!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>未命名頁面</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
我以前只寫過dwp的webPart ,像這種Asp.net頁面調用後臺程序的WebPart該如何部署呢?請指點下,謝謝!