I'm making a guestbook, and one of the values that I'm inserting into the database is the IP address of the user. To get the IP address to bind to the parameter "IP" I added a event that is raised when "Inserting" to the objectdatasource.
From here I just add the value:
protected void ObjectDataSource1_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters["IP"] = Request.UserHostAddress;
}
No comments:
Post a Comment