Here's the code...
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Here's the code...




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Here's the code...  
KMILO


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-25-05 10:49 PM

Manual Login page

public class ManualLogin : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtUsuario;
protected System.Web.UI.WebControls.TextBox txtClave;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldVali
dator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldVali
dator2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.Label lblMensaje;
protected System.Web.UI.WebControls.CheckBox RecordarUsuario;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.DropDownList drpDomains;
protected System.Web.UI.WebControls.Label Label2;
protected CmsAuthenticationTicket CmsTicket;

private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{ 
GetDomains();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{ 
this.drpDomains.SelectedIndexChanged += new System.EventHandler(this.drpDoma
ins_SelectedIndexChanged);
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.Ima
geButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEvent
Args e)
{
Page.Validate();
if (Page.IsValid)
{
lblMensaje.Text = "";
string NTDomain = drpDomains.SelectedValue.Substring(8); 
string Preffix = drpDomains.SelectedValue.Substring(0,8); 
string NTUser = txtUsuario.Text;
string NTPassword = txtClave.Text;
bool persist = RecordarUsuario.Checked; 
bool EstaAutenticado =  AuthenticateUser(Preffix,NTDomain,NTUser
,NTPassword,p
ersist); 
if (EstaAutenticado)
{
//CmsFormsAuthentication.GetUrlToLoginPage(ConfigurationSettings.AppSettings
["CanalRaiz"].ToString()); 
//CmsFormsAuthentication. RedirectFromLoginPage(CmsTicket,true,per
sist); 
Response.Redirect(ConfigurationSettings.AppSettings["CanalRaiz"].ToStrin
g());
} 
}
} 
protected void GetDomains()
{
string Domain;
string ConfigDomain = ConfigurationSettings.AppSettings["Dominio"].ToStr
ing();
string valSelTxtDomain = Request.Form["NR_DOMAIN_LIST"]; 
ListItem ItmDomain;

foreach ( string domain in CmsFormsAuthentication.Domains )
{
string DomainWinNT = domain.Substring( 0, 1 );
if ( DomainWinNT.Equals( "W" ) )
{
Domain = domain.Substring( 8 );
}
else
{
Domain = domain;
} 
ItmDomain = new ListItem(Domain,domain); 
drpDomains.Items.Add(ItmDomain); 

if (ConfigDomain == Domain)
{
drpDomains.Items.FindByText(Domain).Selected = true; 
}
drpDomains.DataBind(); 
} 
} 

private void drpDomains_SelectedIndexChanged(object sender, System.EventArgs
 e)
{

} 

public bool AuthenticateUser(string ServerPreffix,string NTDomain,string NTU
ser,string NTPass,bool persist)
{
try
{ 
return SendIttoCms(ServerPreffix + NTDomain + "/" + NTUser,NTPass,persist); 
} 

catch(CmsAccessDeniedException)
{
return false; 
} 
}

private bool SendIttoCms(string NTUser,string NTPassword,bool persist)
{
bool answer=false;
try
{
CmsTicket = CmsFormsAuthentication.AuthenticateAsUser(NTUser, NTPassword); 
if( CmsTicket != null )
{
CmsFormsAuthentication.GetAuthCookie(CmsTicket,persist); 
//CmsFormsAuthentication.SetAuthCookie(CmsTicket,true, persist ); 
answer = true; 
} 
} 

catch(CmsAccessDeniedException Err)
{
string mess = Err.Message.ToString(); 
} 
return answer;
}
private void CreateCookie(string user, bool isPersistent)
{ 
int CookieTimeOut = Convert.ToInt16(ConfigurationSettings.AppSettings["T
imeOut"].ToString()); 
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(user,isPers
istent,CookieTimeOut);
string encTicket = FormsAuthentication.Encrypt(ticket); 
HttpCookie pltCookie = new HttpCookie(FormsAuthentication.FormsCookieName,en
cTicket);
pltCookie.Expires = System.DateTime.Now.AddMinutes(CookieTimeOut); 
FormsAuthentication. SetAuthCookie(user,isPersistent,pltCooki
e.Path); 
FormsAuthentication.Authenticate( user,encTicket.ToString()); 
HttpContext.Current.Response.Cookies.Add(pltCookie); 
}
}


WEB CONFIG


<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation defaultLanguage="c#" debug="true">
<assemblies>
<add assembly="Microsoft.ContentManagement.Common, Version=5.0.1200.0, Cultu
re=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.Publishing, Version=5.0.1200.0, C
ulture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.Publishing.Extensions.Placeholder
s, Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.Publishing.Extensions.Placeholder
s.Office, Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e
35" />
<add assembly="Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=
neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.WebAuthor, Version=5.0.1200.0, Cu
lture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.WebControls, Version=5.0.1200.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neut
ral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation> 
<customErrors mode="Off"/> 
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortB
yTime" localOnly="true" />
<sessionState mode="InProc" cookieless="false" timeout="30"/>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="es-
CO"/>
<httpModules>
<add type="Cohete.MCMS.HttpModules.CmsNiceUrlHttpModule, Cohete.MCMS.HttpMod
ules" name="CmsNiceUrlHttpModule"></add> 
<add type="Microsoft.ContentManagement.Web.Security.CmsAuthorizationModule, 
Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral, Public
KeyToken=31bf3856ad364e35" name="CmsAuthorizationModule" />
<add type="Microsoft.ContentManagement.Web.CmsEndRequestModule, Microsoft.Co
ntentManagement.Web, Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31b
f3856ad364e35" name="CmsEndRequestModule" />
<add type="Microsoft.ContentManagement.Publishing.Events.PostingEventsModule
, Microsoft.ContentManagement.Publishing, Version=5.0.1200.0, Culture=neutra
l, PublicKeyToken=31bf3856ad364e35" name="CmsPosting" />
<add type="Microsoft.ContentManagement.Web.Caching.CmsCacheModule, Microsoft
.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral, PublicKeyToken=
31bf3856ad364e35" name="CmsCacheModule" />
</httpModules>
<authentication mode="Forms">
<forms loginUrl="ManualLogin.aspx" name="UDEMCookie" path="/" protection="Al
l" timeout="30"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
<pages smartNavigation="false" validateRequest="false" /> 
</system.web> 
<appSettings>
<add key="Dominio" value="kmiloon"/>
<add key="CanalRaiz" value="http://localhost/UDM/"/>
<add key="NombreXml" value="Menu"/>
<add key="PaginaInicial" value="/udm/"/>
<add key="PaginaAutenticacion" value="ManualLogin.aspx"/> 
<add key="TimeOut" value="20"/>
<add key="AdminEmail" value="camilo@cohete.net"/>
</appSettings>
</configuration>





[ Post a follow-up to this message ]



    Re: Here's the code...  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-25-05 10:49 PM

Hi Kmilo,

the response.redirect will not work.
Please use RedirectFromLoginPage instead.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights
Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
----------------------


"KMILO" <camilo@cohete.net> wrote in message
news:#nq1SV1GFHA.3088@tk2msftngp13.phx.gbl...
Manual Login page

public class ManualLogin : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtUsuario;
protected System.Web.UI.WebControls.TextBox txtClave;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.Label lblMensaje;
protected System.Web.UI.WebControls.CheckBox RecordarUsuario;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.DropDownList drpDomains;
protected System.Web.UI.WebControls.Label Label2;
protected CmsAuthenticationTicket CmsTicket;

private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
GetDomains();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.drpDomains.SelectedIndexChanged += new
System.EventHandler(this.drpDomains_SelectedIndexChanged);
this.ImageButton1.Click += new
System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
lblMensaje.Text = "";
string NTDomain = drpDomains.SelectedValue.Substring(8);
string Preffix = drpDomains.SelectedValue.Substring(0,8);
string NTUser = txtUsuario.Text;
string NTPassword = txtClave.Text;
bool persist = RecordarUsuario.Checked;
bool EstaAutenticado =
 AuthenticateUser(Preffix,NTDomain,NTUser
,NTPassword,persist);
if (EstaAutenticado)
{
//CmsFormsAuthentication.GetUrlToLoginPage(ConfigurationSettings.AppSettings
["CanalRaiz"].ToString());
//CmsFormsAuthentication. RedirectFromLoginPage(CmsTicket,true,per
sist);
Response.Redirect(ConfigurationSettings.AppSettings["CanalRaiz"].ToStrin
g())
;
}
}
}
protected void GetDomains()
{
string Domain;
string ConfigDomain =
ConfigurationSettings.AppSettings["Dominio"].ToString();
string valSelTxtDomain = Request.Form["NR_DOMAIN_LIST"];
ListItem ItmDomain;

foreach ( string domain in CmsFormsAuthentication.Domains )
{
string DomainWinNT = domain.Substring( 0, 1 );
if ( DomainWinNT.Equals( "W" ) )
{
Domain = domain.Substring( 8 );
}
else
{
Domain = domain;
}
ItmDomain = new ListItem(Domain,domain);
drpDomains.Items.Add(ItmDomain);

if (ConfigDomain == Domain)
{
drpDomains.Items.FindByText(Domain).Selected = true;
}
drpDomains.DataBind();
}
}

private void drpDomains_SelectedIndexChanged(object sender, System.EventArgs
e)
{

}

public bool AuthenticateUser(string ServerPreffix,string NTDomain,string
NTUser,string NTPass,bool persist)
{
try
{
return SendIttoCms(ServerPreffix + NTDomain + "/" + NTUser,NTPass,persist);
}

catch(CmsAccessDeniedException)
{
return false;
}
}

private bool SendIttoCms(string NTUser,string NTPassword,bool persist)
{
bool answer=false;
try
{
CmsTicket = CmsFormsAuthentication.AuthenticateAsUser(NTUser, NTPassword);
if( CmsTicket != null )
{
CmsFormsAuthentication.GetAuthCookie(CmsTicket,persist);
//CmsFormsAuthentication.SetAuthCookie(CmsTicket,true, persist );
answer = true;
}
}

catch(CmsAccessDeniedException Err)
{
string mess = Err.Message.ToString();
}
return answer;
}
private void CreateCookie(string user, bool isPersistent)
{
int CookieTimeOut =
Convert.ToInt16(ConfigurationSettings.AppSettings["TimeOut"].ToString())
;
FormsAuthenticationTicket ticket = new
 FormsAuthenticationTicket(user,isPersist
ent,CookieTimeOut);
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie pltCookie = new
HttpCookie(FormsAuthentication.FormsCookieName,encTicket);
pltCookie.Expires = System.DateTime.Now.AddMinutes(CookieTimeOut);
FormsAuthentication. SetAuthCookie(user,isPersistent,pltCooki
e.Path);
FormsAuthentication.Authenticate( user,encTicket.ToString());
HttpContext.Current.Response.Cookies.Add(pltCookie);
}
}


WEB CONFIG


<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation defaultLanguage="c#" debug="true">
<assemblies>
<add assembly="Microsoft.ContentManagement.Common, Version=5.0.1200.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.Publishing, Version=5.0.1200.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add
assembly="Microsoft.ContentManagement.Publishing.Extensions.Placeholders,
Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add
assembly="Microsoft.ContentManagement.Publishing.Extensions.Placeholders.Off
ice, Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/>
<add assembly="Microsoft.ContentManagement.Web, Version=5.0.1200.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.WebAuthor, Version=5.0.1200.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ContentManagement.WebControls, Version=5.0.1200.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
<customErrors mode="Off"/>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" cookieless="false" timeout="30"/>
<globalization requestEncoding="utf-8" responseEncoding="utf-8"
culture="es-CO"/>
<httpModules>
<add type="Cohete.MCMS.HttpModules.CmsNiceUrlHttpModule,
Cohete.MCMS.HttpModules" name="CmsNiceUrlHttpModule"></add>
<add type="Microsoft.ContentManagement.Web.Security.CmsAuthorizationModule,
Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" name="CmsAuthorizationModule" />
<add type="Microsoft.ContentManagement.Web.CmsEndRequestModule,
Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" name="CmsEndRequestModule" />
<add
type="Microsoft.ContentManagement.Publishing.Events.PostingEventsModule,
Microsoft.ContentManagement.Publishing, Version=5.0.1200.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" name="CmsPosting" />
<add type="Microsoft.ContentManagement.Web.Caching.CmsCacheModule,
Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" name="CmsCacheModule" />
</httpModules>
<authentication mode="Forms">
<forms loginUrl="ManualLogin.aspx" name="UDEMCookie" path="/"
protection="All" timeout="30"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
<pages smartNavigation="false" validateRequest="false" />
</system.web>
<appSettings>
<add key="Dominio" value="kmiloon"/>
<add key="CanalRaiz" value="http://localhost/UDM/"/>
<add key="NombreXml" value="Menu"/>
<add key="PaginaInicial" value="/udm/"/>
<add key="PaginaAutenticacion" value="ManualLogin.aspx"/>
<add key="TimeOut" value="20"/>
<add key="AdminEmail" value="camilo@cohete.net"/>
</appSettings>
</configuration>







[ Post a follow-up to this message ]



    Re: Here's the code...  
KMILO


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-25-05 10:49 PM

Another NewsGroup member and friend (Thanks Miguel Ballesteros) suggest me
that remove the cookie persistance and it works even with the
response.redirect, but I want to know what really happend here...

Thanks you all for your support

KMILO


"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:uEQKSb1GFHA.3272@TK2MSFTNGP10.phx.gbl...
> Hi Kmilo,
>
> the response.redirect will not work.
> Please use RedirectFromLoginPage instead.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Book: Building Websites Using MCMS: http://tinyurl.com/56jt8
> ----------------------
>
>
> "KMILO" <camilo@cohete.net> wrote in message
> news:#nq1SV1GFHA.3088@tk2msftngp13.phx.gbl...
> Manual Login page
>
> public class ManualLogin : System.Web.UI.Page
> {
> protected System.Web.UI.WebControls.TextBox txtUsuario;
> protected System.Web.UI.WebControls.TextBox txtClave;
> protected System.Web.UI.WebControls.RequiredFieldValidator
> RequiredFieldValidator1;
> protected System.Web.UI.WebControls.RequiredFieldValidator
> RequiredFieldValidator2;
> protected System.Web.UI.WebControls.Label Label1;
> protected System.Web.UI.WebControls.ImageButton ImageButton1;
> protected System.Web.UI.WebControls.Label lblMensaje;
> protected System.Web.UI.WebControls.CheckBox RecordarUsuario;
> protected System.Web.UI.WebControls.Label Label3;
> protected System.Web.UI.WebControls.DropDownList drpDomains;
> protected System.Web.UI.WebControls.Label Label2;
> protected CmsAuthenticationTicket CmsTicket;
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> if (!IsPostBack)
> {
> GetDomains();
> }
> }
> #region Web Form Designer generated code
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> //
> InitializeComponent();
> base.OnInit(e);
> }
>
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.drpDomains.SelectedIndexChanged += new
> System.EventHandler(this.drpDomains_SelectedIndexChanged);
> this.ImageButton1.Click += new
> System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
> this.Load += new System.EventHandler(this.Page_Load);
> }
> #endregion
> private void ImageButton1_Click(object sender,
> System.Web.UI.ImageClickEventArgs e)
> {
> Page.Validate();
> if (Page.IsValid)
> {
> lblMensaje.Text = "";
> string NTDomain = drpDomains.SelectedValue.Substring(8);
> string Preffix = drpDomains.SelectedValue.Substring(0,8);
> string NTUser = txtUsuario.Text;
> string NTPassword = txtClave.Text;
> bool persist = RecordarUsuario.Checked;
> bool EstaAutenticado =
>  AuthenticateUser(Preffix,NTDomain,NTUser
,NTPassword,persist);
> if (EstaAutenticado)
> {
> //CmsFormsAuthentication.GetUrlToLoginPage(ConfigurationSettings.AppSettin
gs
> ["CanalRaiz"].ToString());
> //CmsFormsAuthentication. RedirectFromLoginPage(CmsTicket,true,per
sist);
> Response.Redirect(ConfigurationSettings.AppSettings["CanalRaiz"].ToStr
ing())
> ;
> }
> }
> }
> protected void GetDomains()
> {
> string Domain;
> string ConfigDomain =
> ConfigurationSettings.AppSettings["Dominio"].ToString();
> string valSelTxtDomain = Request.Form["NR_DOMAIN_LIST"];
> ListItem ItmDomain;
>
> foreach ( string domain in CmsFormsAuthentication.Domains )
> {
> string DomainWinNT = domain.Substring( 0, 1 );
> if ( DomainWinNT.Equals( "W" ) )
> {
> Domain = domain.Substring( 8 );
> }
> else
> {
> Domain = domain;
> }
> ItmDomain = new ListItem(Domain,domain);
> drpDomains.Items.Add(ItmDomain);
>
> if (ConfigDomain == Domain)
> {
> drpDomains.Items.FindByText(Domain).Selected = true;
> }
> drpDomains.DataBind();
> }
> }
>
> private void drpDomains_SelectedIndexChanged(object sender,
> System.EventArgs
> e)
> {
>
> }
>
> public bool AuthenticateUser(string ServerPreffix,string NTDomain,string
> NTUser,string NTPass,bool persist)
> {
> try
> {
> return SendIttoCms(ServerPreffix + NTDomain + "/" +
> NTUser,NTPass,persist);
> }
>
> catch(CmsAccessDeniedException)
> {
> return false;
> }
> }
>
> private bool SendIttoCms(string NTUser,string NTPassword,bool persist)
> {
> bool answer=false;
> try
> {
> CmsTicket = CmsFormsAuthentication.AuthenticateAsUser(NTUser, NTPassword);
> if( CmsTicket != null )
> {
> CmsFormsAuthentication.GetAuthCookie(CmsTicket,persist);
> //CmsFormsAuthentication.SetAuthCookie(CmsTicket,true, persist );
> answer = true;
> }
> }
>
> catch(CmsAccessDeniedException Err)
> {
> string mess = Err.Message.ToString();
> }
> return answer;
> }
> private void CreateCookie(string user, bool isPersistent)
> {
> int CookieTimeOut =
> Convert.ToInt16(ConfigurationSettings.AppSettings["TimeOut"].ToString(
));
> FormsAuthenticationTicket ticket = new
>  FormsAuthenticationTicket(user,isPersist
ent,CookieTimeOut);
> string encTicket = FormsAuthentication.Encrypt(ticket);
> HttpCookie pltCookie = new
> HttpCookie(FormsAuthentication.FormsCookieName,encTicket);
> pltCookie.Expires = System.DateTime.Now.AddMinutes(CookieTimeOut);
> FormsAuthentication. SetAuthCookie(user,isPersistent,pltCooki
e.Path);
> FormsAuthentication.Authenticate( user,encTicket.ToString());
> HttpContext.Current.Response.Cookies.Add(pltCookie);
> }
> }
>
>
> WEB CONFIG
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <configuration>
> <system.web>
> <compilation defaultLanguage="c#" debug="true">
> <assemblies>
> <add assembly="Microsoft.ContentManagement.Common, Version=5.0.1200.0,
> Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> <add assembly="Microsoft.ContentManagement.Publishing, Version=5.0.1200.0,
> Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> <add
> assembly="Microsoft.ContentManagement.Publishing.Extensions.Placeholders,
> Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> <add
> assembly="Microsoft.ContentManagement.Publishing.Extensions.Placeholders.O
ff
> ice, Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
> />
> <add assembly="Microsoft.ContentManagement.Web, Version=5.0.1200.0,
> Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> <add assembly="Microsoft.ContentManagement.WebAuthor, Version=5.0.1200.0,
> Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> <add assembly="Microsoft.ContentManagement.WebControls,
> Version=5.0.1200.0,
> Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> <add assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226,
> Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
> </assemblies>
> </compilation>
> <customErrors mode="Off"/>
> <trace enabled="false" requestLimit="10" pageOutput="false"
> traceMode="SortByTime" localOnly="true" />
> <sessionState mode="InProc" cookieless="false" timeout="30"/>
> <globalization requestEncoding="utf-8" responseEncoding="utf-8"
> culture="es-CO"/>
> <httpModules>
> <add type="Cohete.MCMS.HttpModules.CmsNiceUrlHttpModule,
> Cohete.MCMS.HttpModules" name="CmsNiceUrlHttpModule"></add>
> <add
> type="Microsoft.ContentManagement.Web.Security.CmsAuthorizationModule,
> Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral,
> PublicKeyToken=31bf3856ad364e35" name="CmsAuthorizationModule" />
> <add type="Microsoft.ContentManagement.Web.CmsEndRequestModule,
> Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral,
> PublicKeyToken=31bf3856ad364e35" name="CmsEndRequestModule" />
> <add
> type="Microsoft.ContentManagement.Publishing.Events.PostingEventsModule,
> Microsoft.ContentManagement.Publishing, Version=5.0.1200.0,
> Culture=neutral,
> PublicKeyToken=31bf3856ad364e35" name="CmsPosting" />
> <add type="Microsoft.ContentManagement.Web.Caching.CmsCacheModule,
> Microsoft.ContentManagement.Web, Version=5.0.1200.0, Culture=neutral,
> PublicKeyToken=31bf3856ad364e35" name="CmsCacheModule" />
> </httpModules>
> <authentication mode="Forms">
> <forms loginUrl="ManualLogin.aspx" name="UDEMCookie" path="/"
> protection="All" timeout="30"/>
> </authentication>
> <authorization>
> <allow users="*"/>
> </authorization>
> <pages smartNavigation="false" validateRequest="false" />
> </system.web>
> <appSettings>
> <add key="Dominio" value="kmiloon"/>
> <add key="CanalRaiz" value="http://localhost/UDM/"/>
> <add key="NombreXml" value="Menu"/>
> <add key="PaginaInicial" value="/udm/"/>
> <add key="PaginaAutenticacion" value="ManualLogin.aspx"/>
> <add key="TimeOut" value="20"/>
> <add key="AdminEmail" value="camilo@cohete.net"/>
> </appSettings>
> </configuration>
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:47 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register