Click here to Skip to main content
15,899,474 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: RE: Session expire Pin
vnsraj16-Feb-09 19:11
vnsraj16-Feb-09 19:11 
GeneralRe: RE: Session expire Pin
Abhijit Jana16-Feb-09 19:20
professionalAbhijit Jana16-Feb-09 19:20 
GeneralRe: RE: Session expire Pin
Abhijit Jana16-Feb-09 19:24
professionalAbhijit Jana16-Feb-09 19:24 
GeneralRe: RE: Session expire Pin
rakeshs31216-Feb-09 19:44
rakeshs31216-Feb-09 19:44 
QuestionSession has expire within few min. Pin
vnsraj16-Feb-09 18:13
vnsraj16-Feb-09 18:13 
AnswerRe: Session has expire within few min. Pin
Vimalsoft(Pty) Ltd16-Feb-09 19:22
professionalVimalsoft(Pty) Ltd16-Feb-09 19:22 
AnswerRe: Session has expire within few min. Pin
N a v a n e e t h16-Feb-09 19:52
N a v a n e e t h16-Feb-09 19:52 
QuestionActive Directory Pin
sheebalam11116-Feb-09 18:07
sheebalam11116-Feb-09 18:07 
I have intergrated with Active Directory But i wana Give access to Groups in Active Directory...
I dont want HR group to access my page Only IT and other Groups in AD can access...
Can some one help and send me the code...



Login.aspx.cs


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.DirectoryServices;

public partial class Login : System.Web.UI.Page
{

public string myEmployeeID;

protected void Page_Load(object sender, EventArgs e)
{

}

private bool Authenticate(string domain, string txtusername, string txtpassword)
{
bool authentic = false;
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain,
txtusername, txtpassword);
object nativeObject = entry.NativeObject;
authentic = true;
}
catch (DirectoryServicesCOMException) { }
return authentic;
}

protected void Button1_Click(object sender, EventArgs e)
{
string adPath = ConfigurationSettings.AppSettings["strADPathVar"].ToString(); ;
//Authenticate adAuth = new Authenticate(adPath);


try
{
string strDomain = ConfigurationSettings.AppSettings["strdomainVar"].ToString();

if (true == Authenticate(strDomain, txtusername.Text, txtpassword.Text))
{
string groups = "";

FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, // version
txtusername.Text,
DateTime.Now,
DateTime.Now.AddMinutes(60),
false, groups);
// Now encrypt the ticket.
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
// Redirect the user to the originally requested page
Response.Redirect(FormsAuthentication.GetRedirectUrl(txtusername.Text, false));

}

else
{
lblError.Text = "Error: Unknown user ID or bad password.";
}
}
catch (Exception ex)
{
lblError.Text = ex.Message;


}

}

cheers

AnswerRe: Active Directory Pin
Brij16-Feb-09 19:25
mentorBrij16-Feb-09 19:25 
GeneralRe: Active Directory Pin
sheebalam11116-Feb-09 21:11
sheebalam11116-Feb-09 21:11 
GeneralRe: Active Directory Pin
Brij19-Feb-09 23:23
mentorBrij19-Feb-09 23:23 
Questionhow to get the data of a row of grid view Pin
raghvendrapanda16-Feb-09 17:45
raghvendrapanda16-Feb-09 17:45 
QuestionWhy I can't submit a article? Pin
makongkong16-Feb-09 16:43
makongkong16-Feb-09 16:43 
AnswerRe: Why I can't submit a article? Pin
Christian Graus16-Feb-09 17:32
protectorChristian Graus16-Feb-09 17:32 
GeneralRe: Why I can't submit a article? Pin
makongkong16-Feb-09 20:50
makongkong16-Feb-09 20:50 
QuestionWeb Forms from Database Pin
Dewayne Dodd16-Feb-09 9:22
Dewayne Dodd16-Feb-09 9:22 
AnswerRe: Web Forms from Database [modified] Pin
Rutvik Dave16-Feb-09 11:06
professionalRutvik Dave16-Feb-09 11:06 
GeneralRe: Web Forms from Database Pin
Dewayne Dodd16-Feb-09 11:43
Dewayne Dodd16-Feb-09 11:43 
GeneralRe: Web Forms from Database Pin
Rutvik Dave17-Feb-09 4:02
professionalRutvik Dave17-Feb-09 4:02 
GeneralRe: Web Forms from Database Pin
Dewayne Dodd17-Feb-09 2:39
Dewayne Dodd17-Feb-09 2:39 
QuestionRepeater Control and SQL DataBase Pin
Terick16-Feb-09 7:33
Terick16-Feb-09 7:33 
AnswerRe: Repeater Control and SQL DataBase Pin
Christian Graus16-Feb-09 9:56
protectorChristian Graus16-Feb-09 9:56 
QuestionNeed help with ImageButton Pin
AprNgp16-Feb-09 7:05
AprNgp16-Feb-09 7:05 
AnswerRe: Need help with ImageButton Pin
Christian Graus16-Feb-09 9:57
protectorChristian Graus16-Feb-09 9:57 
AnswerRe: Need help with ImageButton Pin
Jörgen Andersson16-Feb-09 9:58
professionalJörgen Andersson16-Feb-09 9:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.