using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography;
using System.Text;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Data.OleDb;

public partial class code_register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void CreateUserWizard1_ContinueButtonClick(object sender, EventArgs e)
    {        

        OleDbConnection conn = null;
        OleDbCommand command = null;
        string another = WebConfigurationManager.ConnectionStrings["AccessFileName"].ToString();

        string sql = "UPDATE aspnet_Membership SET IP=@ip WHERE (Email=@email)";

        try
        {
            conn = new OleDbConnection(another);
            conn.Open();
            command = new OleDbCommand(sql, conn);
         
            command.Parameters.AddWithValue("@ip", Request.UserHostAddress.ToString());
            command.Parameters.AddWithValue("@email", CreateUserWizard1.Email);

            int added = 0;
            try
            {
                added = command.ExecuteNonQuery();

            }
            catch (Exception err)
            {
                Label1.Text ="Errore: " + err.ToString();
            }
        }
        finally
        {
            if (conn != null)
            {
                conn.Close();
            }
        }

       Response.Redirect("~/code/mypage.aspx");
    }
}