G
Guest
Hi
Any idea what's happening, please?! TIA, details.....
I have a formA.aspx page and a corresponding class file formA.cs compiled
into a library. User is to fill out some information and click a submit
button to trigger a click event. Here is what I have in formA.cs
{
public Button btnOUCreate;
public Label Label1;
public TextBox txtACNo, txtCompanyName;
public ouCreate() {
}
void InitializeComponent()
{
btnOUCreate.Click += new
System.EventHandler(this.btnOUCreate_Click);
}
protected override void OnInit(EventArgs e)
{
this.InitializeComponent();
base.OnInit(e);
//throw new Exception("The method or operation is not
implemented.");
}
void Page_Load(object sender, EventArgs e)
{
//IPrincipal myPrincipal = this.User;
Label1.Text = HttpContext.Current.User.Identity.Name;
}
void btnOUCreate_Click(Object sender, EventArgs e)
{
String domain, str_path, newOUName;
//code to create OU
if (IsValid) {
newOUName = txtACNo.Text;
domain =
System.Configuration.ConfigurationSettings.AppSettings["DN"];
str_path = "LDAP://" + domain;
try
{
DirectoryEntry myDir = new DirectoryEntry(str_path);
DirectoryEntry newOU = myDir.Children.Add(newOUName, "OU");
}
catch (Exception Exception1)
{
System.Runtime.InteropServices.COMException COMEx =
(System.Runtime.InteropServices.COMException)Exception1;
//ConsoleWriteline(COMEx.ErrorCode);
}
//code to add UPN
}
}
}
------
Here is the Stack trace
[NullReferenceException: Object reference not set to an instance of an
object.]
NETDS.ouCreate.btnOUCreate_Click(Object sender, EventArgs e) +38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
--
Any idea what's happening, please?! TIA, details.....
I have a formA.aspx page and a corresponding class file formA.cs compiled
into a library. User is to fill out some information and click a submit
button to trigger a click event. Here is what I have in formA.cs
{
public Button btnOUCreate;
public Label Label1;
public TextBox txtACNo, txtCompanyName;
public ouCreate() {
}
void InitializeComponent()
{
btnOUCreate.Click += new
System.EventHandler(this.btnOUCreate_Click);
}
protected override void OnInit(EventArgs e)
{
this.InitializeComponent();
base.OnInit(e);
//throw new Exception("The method or operation is not
implemented.");
}
void Page_Load(object sender, EventArgs e)
{
//IPrincipal myPrincipal = this.User;
Label1.Text = HttpContext.Current.User.Identity.Name;
}
void btnOUCreate_Click(Object sender, EventArgs e)
{
String domain, str_path, newOUName;
//code to create OU
if (IsValid) {
newOUName = txtACNo.Text;
domain =
System.Configuration.ConfigurationSettings.AppSettings["DN"];
str_path = "LDAP://" + domain;
try
{
DirectoryEntry myDir = new DirectoryEntry(str_path);
DirectoryEntry newOU = myDir.Children.Add(newOUName, "OU");
}
catch (Exception Exception1)
{
System.Runtime.InteropServices.COMException COMEx =
(System.Runtime.InteropServices.COMException)Exception1;
//ConsoleWriteline(COMEx.ErrorCode);
}
//code to add UPN
}
}
}
------
Here is the Stack trace
[NullReferenceException: Object reference not set to an instance of an
object.]
NETDS.ouCreate.btnOUCreate_Click(Object sender, EventArgs e) +38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
--