Voici le code de la page en question :
<% @Page Language="C#" Debug="true" %>
<% @Import Namespace="System " %>
<% @Import Namespace="System.Web.Security " %>
<% @Import Namespace="System.Security.Principal" %>
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication" %>
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal.WebFeedConfigHandler" %>
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="C#" runat=server>
//
// Customizable Text
//
string L_CompanyName_Text = "Connexion par défaut aux services Bureau à distance";
const string L_ApplicationName_Text = "Connexions aux programmes RemoteApp et aux services Bureau à distance";
//
// Localizable Text
//
const string L_HelpTab_Text = "Aide";
const string L_DomainUserNameLabel_Text = "Domaine\\Nom d’utilisateur :";
const string L_PasswordLabel_Text = "Mot de passe :";
const string L_ExistingWorkspaceLabel_Text = "Un autre utilisateur de votre ordinateur est en train d’utiliser cette connexion. Cet utilisateur doit se déconnecter pour que vous puissiez vous connecter.";
const string L_DisconnectedWorkspaceLabel_Text = "Un autre utilisateur de votre ordinateur s’est déconnecté de cette connexion. Entrez à nouveau votre nom d’utilisateur et votre mot de passe.";
const string L_LogonFailureLabel_Text = "Le nom d’utilisateur ou le mot de passe que vous avez entré n’est pas valide. Réessayez.";
const string L_AuthorizationFailureLabel_Text = "Vous n’êtes pas autorisé à ouvrir une session avec cette connexion. Contactez votre administrateur système pour obtenir une autorisation.";
const string L_ServerConfigChangedLabel_Text = "Votre session Accès Bureau à distance par le Web a expiré en raison de modifications de configuration sur l’ordinateur distant. Reconnectez-vous.";
const string L_SecurityLabel_Text = "Sécurité";
const string L_ShowExplanationLabel_Text = "afficher les explications";
const string L_HideExplanationLabel_Text = "masquer les explications";
const string L_PublicLabel_Text = "Ceci est un ordinateur public ou partagé.";
const string L_PublicExplanationLabel_Text = "Sélectionnez cette option si vous utilisez l’accès Bureau à distance par le Web sur un ordinateur public. Lorsque vous n’utilisez plus ce service, pensez à vous déconnecter et fermez toutes les fenêtres pour clore votre session.";
const string L_PrivateLabel_Text = "Ceci est un ordinateur privé.";
const string L_PrivateExplanationLabel_Text = "Sélectionnez cette option si vous êtes la seule personne à utiliser cet ordinateur. Votre serveur autorisera une plus longue période d’inactivité avant de mettre fin à votre session.";
const string L_PrivateWarningLabel_Text = "Avertissement : en sélectionnant cette option, vous confirmez que cet ordinateur se conforme à la stratégie de sécurité de votre entreprise.";
const string L_SignInLabel_Text = "S’inscrire";
const string L_TSWATimeoutLabel_Text = "Pour vous protéger contre les accès non autorisés, votre session Accès Bureau à distance par le Web expirera automatiquement après une période d’inactivité. Si votre session se termine, actualisez votre navigateur et reconnectez-vous.";
//
// Page Variables
//
public string sRootDir, strErrorMessageRowStyle;
public bool bFailedLogon = false, bFailedAuthorization = false, bServerConfigChanged = false, bWorkspaceInUse = false, bWorkspaceDisconnected = false;
public string strWorkSpaceID = "";
public string strRDPCertificates = "";
public string strReturnUrl = "";
public string strReturnUrlPage = "";
public string sHelpSourceServer, sLocalHelp;
public string strPrivateModeTimeout = "240";
public string strPublicModeTimeout = "20";
public WorkspaceInfo objWorkspaceInfo = null;
void Page_PreInit(object sender, EventArgs e)
{
sRootDir = Request.ApplicationPath + "/";
sLocalHelp = ConfigurationManager.AppSettings["LocalHelp"];
if ((sLocalHelp != null) && (sLocalHelp == "true" ))
{
sHelpSourceServer = "./rap-help.htm";
}
else
{
sHelpSourceServer = "http://go.microsoft.com/fwlink/?LinkId=141038";
}
objWorkspaceInfo = RdwaConfig.GetWorkspaceInfo();
if ( objWorkspaceInfo != null )
{
strWorkSpaceID = objWorkspaceInfo.WorkspaceId;
string strWorkspaceName = objWorkspaceInfo.WorkspaceName;
if ( String.IsNullOrEmpty(strWorkspaceName ) == false )
{
L_CompanyName_Text = strWorkspaceName;
}
}
strRDPCertificates = RdwaConfig.GetRdpSigningCertificateHash();
RdwaConfig.AddGroupsForAdministrativeAccess("TS Web Access Administrators" );
RdwaConfig.AddGroupsForAdministrativeAccess(System.Security.Principal.WindowsBuiltInRole.Administrator);
try
{
strPrivateModeTimeout = ConfigurationManager.AppSettings["PrivateModeSessionTimeoutInMinutes"].ToString();
strPublicModeTimeout = ConfigurationManager.AppSettings["PublicModeSessionTimeoutInMinutes"].ToString();
}
catch (Exception objException)
{
}
}
void Page_Load(object sender, EventArgs e)
{
if ( Request.QueryString != null )
{
NameValueCollection objQueryString = Request.QueryString;
if ( objQueryString["ReturnUrl"] != null )
{
strReturnUrlPage = objQueryString["ReturnUrl"];
strReturnUrl = "?ReturnUrl=" + strReturnUrlPage;
if ( strReturnUrlPage.Equals("default.aspx", StringComparison.CurrentCultureIgnoreCase) == true &&
objQueryString["p"] != null && objQueryString["p"] == "c"
)
{
strReturnUrlPage = "config.aspx";
strReturnUrl = "?ReturnUrl=" + strReturnUrlPage;
}
}
if ( objQueryString["Error"] != null )
{
if ( objQueryString["Error"].Equals("WkSInUse", StringComparison.CurrentCultureIgnoreCase) )
{
bWorkspaceInUse = true;
}
else if ( objQueryString["Error"].Equals("WkSDisconnected", StringComparison.CurrentCultureIgnoreCase) )
{
bWorkspaceDisconnected = true;
}
else if ( objQueryString["Error"].Equals("UnauthorizedAccess", StringComparison.CurrentCultureIgnoreCase) )
{
bFailedAuthorization = true;
}
else if ( objQueryString["Error"].Equals("ServerConfigChanged", StringComparison.CurrentCultureIgnoreCase) )
{
bServerConfigChanged = true;
}
}
}
//
// Special case to handle 'ServerConfigChanged' error from Response's Location header.
//
try
{
if ( Response.Headers != null )
{
NameValueCollection objResponseHeader = Response.Headers;
if ( !String.IsNullOrEmpty( objResponseHeader["Location"] ) )
{
Uri objLocationUri = new Uri( objResponseHeader["Location"] );
if ( objLocationUri.Query.IndexOf("ServerConfigChanged" ) != -1 )
{
if ( !bFailedAuthorization )
{
bServerConfigChanged = true;
}
}
}
}
}
catch (Exception objException)
{
}
if ( HttpContext.Current.User.Identity.IsAuthenticated == true )
{
if ( String.IsNullOrEmpty(strReturnUrlPage) )
{
Response.Redirect("default.aspx" );
}
else
{
Response.Redirect(strReturnUrlPage);
}
}
else if ( HttpContext.Current.Request.HttpMethod.Equals("POST", StringComparison.CurrentCultureIgnoreCase) == true )
{
bFailedLogon = true;
if ( bFailedAuthorization )
{
bFailedAuthorization = false; // Make sure to show one message.
}
}
}
</script>
<html>
<head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8">
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UNICODE" />
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" />
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link href="tswa.css" rel="stylesheet" type="text/css" />
<title ID="PAGE_TITLE">Accès Bureau à distance par le Web</title>
<script language="javascript" type="text/javascript" src='<%=sRootDir%>renderscripts.js'></script>
<script language="javascript" type="text/javascript">
var sHelpSource = "<%=sHelpSourceServer%>";
setFileRoot('<%=sRootDir%>');
</script>
</head>
<body onload="onLoginPageLoad(event)" onunload="onPageUnload(event)">
<form id="FrmLogin" name="FrmLogin" action="login.aspx<%=strReturnUrl%>" method="post" onsubmit="return onLoginFormSubmit()">
<input type="hidden" name="WorkSpaceID" value="<%=strWorkSpaceID%>">
<input type="hidden" name="RDPCertificates" value="<%=strRDPCertificates%>">
<input type="hidden" name="PublicModeTimeout" value="<%=strPublicModeTimeout%>">
<input type="hidden" name="PrivateModeTimeout" value="<%=strPrivateModeTimeout%>">
<input name="isUtf8" type="hidden" value="1">
<input type="hidden" name="flags" value="0">
<noscript>
<p ID=NoScript1>L’Accès Bureau à distance par le Web requiert JScript. Ce navigateur Web ne prend pas en charge JScript, ou les scripts sont bloqués.</p>
<br /><br />
<p ID=NoScript2>Pour savoir si votre navigateur prend en charge JScript, ou pour autoriser les scripts, voir l’aide en ligne du navigateur.</p>
</noscript>
<!-- Page Table -->
<table border="0" align="center" cellpadding="0" cellspacing="0">
<!-- 1st Row (Empty) -->
<tr>
<td height="20"></td>
</tr>
<!-- 2nd Row (Top Border Images) -->
<tr>
<td>
<table width="932" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="15" height="15" background="../images/top_left.png"></td>
<td width="902" height="15" background="../images/top_mid.png"></td>
<td width="15" height="15" background="../images/top_right.png"></td>
</tr>
</table>
</td>
</tr>
<!-- 3rd Row (Main)-->
<tr>
<td>
<!-- Contents and Controls Table (1 Row, 3 Columns) -->
<table width="932" border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- Col 1 - Left Border Images -->
<td width="15" background="../images/left_mid.png"> </td>
<!-- Col 2 - Contents and Controls -->
<td width="902">
<!-- Inner Contents and Controls Table (8 Rows, 1 Column) -->
<table width="900" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="pageBorder">
<!-- 1st Row - RD Web Access Logo -->
<tr>
<td height="24" bgcolor="#7EA3BE">
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../images/logo_01.png" width="16" height="16"></td>
<td width="5"> </td>
<td class="headingTSWA">RD Web Access</td>
<td width="9"> </td>
</tr>
</table>
</td>
</tr>
<!-- 2nd Row - Empty -->
<tr>
<td height="1"></td>
</tr>
<!-- 3rd Row - Customizable Banner and Text Row -->
<tr>
<td height="90" background="../images/banner_01.jpg">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30"> </td>
<!-- Replaceable Company Logo Image -->
<td><img src="../images/logo_02.png" width="48" height="48"></td>
<td width="10"> </td>
<!-- Replaceable Company Logo Text and Application Type -->
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="headingCompanyName"><%=L_CompanyName_Text%></td>
</tr>
<tr>
<td class="headingApplicationName"><%=L_ApplicationName_Text%></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- 4th Row - Navigation Table -->
<tr>
<td height="40" align="right">
<!-- Login Page only contains Help link -->
<table border="0" cellpadding="0" cellspacing="0" class="linkSecondaryNavigiationBar">
<tr>
<td><a id='PORTAL_HELP' href="javascript:onClickHelp()"><%=L_HelpTab_Text%></a></td>
<td width="30"> </td>
</tr>
</table>
</td>
</tr>
<!-- 5th Row - Image -->
<tr>
<td><img src="../images/bar_03.jpg" width="900" height="10"></td>
</tr>
<!-- 6th Row - Empty -->
<tr>
<td height="10"></td>
</tr>
<!-- 7th Row - Form Visible Controls -->
<tr>
<td>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20"> </td>
</tr>
<tr>
<td>
<table width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="130" align="right"><%=L_DomainUserNameLabel_Text%></td>
<td width="7"></td>
<td align="right">
<label><input id="DomainUserName" name="DomainUserName" type="text" class="textInputField" runat="server" size="25" autocomplete="off" /></label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="7"></td>
</tr>
<tr>
<td>
<table width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="130" align="right"><%=L_PasswordLabel_Text%></td>
<td width="7"></td>
<td align="right">
<label><input id="UserPass" name="UserPass" type="password" class="textInputField" runat="server" size="25" autocomplete="off" /></label>
</td>
</tr>
</table>
</td>
</tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bWorkspaceInUse == true )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="trErrorWorkSpaceInUse" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td><span class="wrng"><%=L_ExistingWorkspaceLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bWorkspaceDisconnected == true )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="trErrorWorkSpaceDisconnected" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td><span class="wrng"><%=L_DisconnectedWorkspaceLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bFailedLogon == true )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="trErrorIncorrectCredentials" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td><span class="wrng"><%=L_LogonFailureLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bFailedAuthorization )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="trErrorUnauthorizedAccess" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td><span class="wrng"><%=L_AuthorizationFailureLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bServerConfigChanged )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="trErrorServerConfigChanged" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td><span class="wrng"><%=L_ServerConfigChangedLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><%=L_SecurityLabel_Text%> (<a href="#" id="lnkShwSec" onclick="onclickExplanation('lnkShwSec')"><%=L_ShowExplanationLabel_Text%></a><a href="#" id="lnkHdSec" onclick="onclickExplanation('lnkHdSec')" style="display:none"><%=L_HideExplanationLabel_Text%></a> )</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30">
<label><input id="rdoPblc" type="radio" name="MachineType" value="public" class="rdo" onclick="onClickSecurity()" checked /></label>
</td>
<td><%=L_PublicLabel_Text%></td>
</tr>
<tr id="trPubExp" style="display:none" >
<td width="30"></td>
<td><span class="expl"><%=L_PublicExplanationLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="7"></td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30">
<label><input id="rdoPrvt" type="radio" name="MachineType" value="private" class="rdo" onclick="onClickSecurity()" /></label>
</td>
<td><%=L_PrivateLabel_Text%></td>
</tr>
<tr id="trPrvtExp" style="display:none" >
<td width="30"></td>
<td><span class="expl"><%=L_PrivateExplanationLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="7"></td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr id="trPrvtWrn" style="display:none" >
<td width="30"></td>
<td><span class="wrng"><%=L_PrivateWarningLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td align="right"><label><input type="submit" class="formButton" id="btnSignIn" value="<%=L_SignInLabel_Text%>" /></label>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td><%=L_TSWATimeoutLabel_Text%></td>
</tr>
<tr>
<td height="30"> </td>
</tr>
</table>
</td>
</tr>
<!-- 8th Row - Footer -->
<tr>
<td height="50" background="../images/banner_02.jpg" bgcolor="#D7E7F7">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- Windows Server Logo -->
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30"> </td>
<td><img src="../images/WS_h_c.png" width="143" height="20"></td>
</tr>
</table>
</td>
<!-- Microsoft Logo -->
<td align="right">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../images/mslogo_black.png" width="63" height="10"></td>
<td width="30"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<!-- Col 3 - Right Border Images -->
<td width="15" background="../images/right_mid.png"> </td>
</tr>
</table>
</td>
</tr>
<!-- 4th Row (Bottom Border Images) -->
<tr>
<td>
<table width="932" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="15" height="15" background="../images/bottom_left.png"></td>
<td width="902" height="15" background="../images/bottom_mid.png"></td>
<td width="15" height="15" background="../images/bottom_right.png"></td>
</tr>
</table>
</td>
</tr>
<!-- 5th Row (Empty) -->
<tr>
<td height="20"></td>
</tr>
</table>
</form>
</body>
</html>