H
Hai Nguyen
Page 1:
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
//step1.Font.Bold = true;
StateList();
string clientIP1 = Request.UserHostAddress;
string strServername = Request.ServerVariables["SERVER_NAME"];
string strServerIP = Request.ServerVariables["LOCAL_ADDR"];
string strRemoteIP = Request.ServerVariables["REMOTE_ADDR"];
string[] str1 = Request.UserLanguages;
Response.Write(clientIP1+ "<br>");
Response.Write(strServername +"<br>");
Response.Write(strServerIP+"<br>");
Response.Write(strRemoteIP+"<br>");
for (int count = 0; count < str1.Length; count++)
{
Response.Write("User Language " + count +": " + str1[count] + "<br>");
}
}
}
IF I used this: Page 2: System.Web.UI.Page it's correct
but if i use this Page 2: Page 1 there is an error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 272: //Update the statebox used ArrayList above
Line 273: //statebox = new DropDownList();
Line 274: statebox.DataSource = StateList;
Line 275: statebox.DataBind();
Line 276: }
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
//step1.Font.Bold = true;
StateList();
string clientIP1 = Request.UserHostAddress;
string strServername = Request.ServerVariables["SERVER_NAME"];
string strServerIP = Request.ServerVariables["LOCAL_ADDR"];
string strRemoteIP = Request.ServerVariables["REMOTE_ADDR"];
string[] str1 = Request.UserLanguages;
Response.Write(clientIP1+ "<br>");
Response.Write(strServername +"<br>");
Response.Write(strServerIP+"<br>");
Response.Write(strRemoteIP+"<br>");
for (int count = 0; count < str1.Length; count++)
{
Response.Write("User Language " + count +": " + str1[count] + "<br>");
}
}
}
IF I used this: Page 2: System.Web.UI.Page it's correct
but if i use this Page 2: Page 1 there is an error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 272: //Update the statebox used ArrayList above
Line 273: //statebox = new DropDownList();
Line 274: statebox.DataSource = StateList;
Line 275: statebox.DataBind();
Line 276: }