Click here to Skip to main content
15,898,769 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: how to implement Multi-Tenant Data Architecture in asp.net 2.0 Pin
Pete O'Hanlon17-Feb-09 4:04
mvePete O'Hanlon17-Feb-09 4:04 
QuestionUrgent Menu Querry Pin
Member 284246817-Feb-09 1:55
Member 284246817-Feb-09 1:55 
AnswerRe: Urgent Menu Querry Pin
Pete O'Hanlon17-Feb-09 2:01
mvePete O'Hanlon17-Feb-09 2:01 
AnswerRe: Urgent Menu Querry Pin
Leonardo Muzzi17-Feb-09 3:36
Leonardo Muzzi17-Feb-09 3:36 
QuestionControlling the ToolboxItem control type during a drag operation Pin
astibich216-Feb-09 20:04
astibich216-Feb-09 20:04 
QuestionCounting Bandwidth/Data Whilst Consuming a Web Service Pin
SharpenedC16-Feb-09 14:51
SharpenedC16-Feb-09 14:51 
QuestionCrystal Report Error on VS2005 Pin
bobbymale7716-Feb-09 11:45
bobbymale7716-Feb-09 11:45 
QuestionActive Directory Group Pin
sheebalam11115-Feb-09 23:36
sheebalam11115-Feb-09 23:36 
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;


}

}

sheeba

AnswerRe: Active Directory Group Pin
Mark Salsbery16-Feb-09 5:29
Mark Salsbery16-Feb-09 5:29 
QuestionReadonly SelectionList Pin
mandrew36015-Feb-09 21:49
mandrew36015-Feb-09 21:49 
AnswerRe: Readonly SelectionList Pin
Mark Salsbery16-Feb-09 5:30
Mark Salsbery16-Feb-09 5:30 
QuestionManagement of mulitple instances of an application Pin
jimmov115-Feb-09 16:01
jimmov115-Feb-09 16:01 
Generalcross-post Pin
Luc Pattyn15-Feb-09 16:38
sitebuilderLuc Pattyn15-Feb-09 16:38 
Question.net obfuscation tool Pin
koleraba15-Feb-09 3:52
koleraba15-Feb-09 3:52 
AnswerRe: .net obfuscation tool Pin
Eddy Vluggen15-Feb-09 4:06
professionalEddy Vluggen15-Feb-09 4:06 
GeneralRe: .net obfuscation tool Pin
koleraba15-Feb-09 6:12
koleraba15-Feb-09 6:12 
GeneralRe: .net obfuscation tool Pin
Eddy Vluggen15-Feb-09 7:48
professionalEddy Vluggen15-Feb-09 7:48 
AnswerRe: .net obfuscation tool Pin
Giorgi Dalakishvili15-Feb-09 7:46
mentorGiorgi Dalakishvili15-Feb-09 7:46 
AnswerRe: .net obfuscation tool Pin
SharpenedC16-Feb-09 14:57
SharpenedC16-Feb-09 14:57 
Questiondeployment of windows application Pin
murali080814-Feb-09 21:19
murali080814-Feb-09 21:19 
AnswerRe: deployment of windows application Pin
Curtis Schlak.25-Feb-09 8:08
Curtis Schlak.25-Feb-09 8:08 
Questionvs2008 ans 3.5 sp1 problem with System.Web.Extensions Pin
icewolf_snowfire14-Feb-09 14:29
icewolf_snowfire14-Feb-09 14:29 
AnswerRe: vs2008 ans 3.5 sp1 problem with System.Web.Extensions Pin
flakzeus20-Feb-09 3:55
flakzeus20-Feb-09 3:55 
GeneralRe: vs2008 ans 3.5 sp1 problem with System.Web.Extensions Pin
icewolf_snowfire20-Feb-09 3:58
icewolf_snowfire20-Feb-09 3:58 
QuestionBusiness Objects and Interfaces Pin
Jordon4Kraftd13-Feb-09 6:36
Jordon4Kraftd13-Feb-09 6:36 

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.