D
Dave
I'm trying to adjust my default.aspx page to see if the user is
accessing it from a smart phone. In a previous post someone suggested
using Page.Request.UserAgent. After reviewing the possibilities I
added the below code to my Page_Load.
The below runs fine in Visual Studio. When moving it out to my Web
Server sitting in the DMZ none of the varialbes are returning. No
errors are being generated and the Stored Procedure doesn't even show
up in Profiler. I've tried dropping everything and just putting a
Response.Write("Test")....It's as if the Page_Load isn't even firing.
It should be noted that this is the home page in the web. Any
thoughts or suggested?
Thanks
*****CODE****
namespace Web
{
public partial class _default : System.Web.UI.Page
{
ReportError rE = new ReportError();
protected void Page_Load(object sender, EventArgs e)
{
try
{
rE.Error = "";
string a = Page.Request.UserAgent.ToString();
string b = Page.Request.UserHostAddress.ToString();
string c = Environment.MachineName.ToString();
string strConnection =
ConfigurationManager.ConnectionStrings["VortexConnectionString"].ConnectionString;
using (SqlConnection connection = new
SqlConnection(strConnection))
{
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = "UserAgentInfo_INSERT";
command.Parameters.AddWithValue("@UserAgent",
a.ToString());
command.Parameters.AddWithValue("@UserHostAddress", b.ToString());
command.Parameters.AddWithValue("@UserHostName",
c.ToString());
command.Parameters.Add("@ErrorCode",
SqlDbType.VarChar, 50);
command.Parameters["@ErrorCode"].Direction =
ParameterDirection.Output;
command.Parameters.Add("@ErrorMessage",
SqlDbType.VarChar, 500);
command.Parameters["@ErrorMessage"].Direction =
ParameterDirection.Output;
command.CommandType = CommandType.StoredProcedure;
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}
}
catch (Exception ex)
{
rE.Error = ex.Message;
}
}
}
}
accessing it from a smart phone. In a previous post someone suggested
using Page.Request.UserAgent. After reviewing the possibilities I
added the below code to my Page_Load.
The below runs fine in Visual Studio. When moving it out to my Web
Server sitting in the DMZ none of the varialbes are returning. No
errors are being generated and the Stored Procedure doesn't even show
up in Profiler. I've tried dropping everything and just putting a
Response.Write("Test")....It's as if the Page_Load isn't even firing.
It should be noted that this is the home page in the web. Any
thoughts or suggested?
Thanks
*****CODE****
namespace Web
{
public partial class _default : System.Web.UI.Page
{
ReportError rE = new ReportError();
protected void Page_Load(object sender, EventArgs e)
{
try
{
rE.Error = "";
string a = Page.Request.UserAgent.ToString();
string b = Page.Request.UserHostAddress.ToString();
string c = Environment.MachineName.ToString();
string strConnection =
ConfigurationManager.ConnectionStrings["VortexConnectionString"].ConnectionString;
using (SqlConnection connection = new
SqlConnection(strConnection))
{
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = "UserAgentInfo_INSERT";
command.Parameters.AddWithValue("@UserAgent",
a.ToString());
command.Parameters.AddWithValue("@UserHostAddress", b.ToString());
command.Parameters.AddWithValue("@UserHostName",
c.ToString());
command.Parameters.Add("@ErrorCode",
SqlDbType.VarChar, 50);
command.Parameters["@ErrorCode"].Direction =
ParameterDirection.Output;
command.Parameters.Add("@ErrorMessage",
SqlDbType.VarChar, 500);
command.Parameters["@ErrorMessage"].Direction =
ParameterDirection.Output;
command.CommandType = CommandType.StoredProcedure;
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}
}
catch (Exception ex)
{
rE.Error = ex.Message;
}
}
}
}