Visual Basic.NET - TRADUCIR AL VISUAL BASIC.NET URGENTE!!!!

 
Vista:

TRADUCIR AL VISUAL BASIC.NET URGENTE!!!!

Publicado por SARA (6 intervenciones) el 12/08/2007 23:16:47
hola buenas, alguien me puede dar el codigo hecho en visual basic es que esta hecho en C# Muchisimas gracias.

protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
if (HttpContext.Current.User!=null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
FormsIdentity id=
(FormsIdentity)(HttpContext.Current.User.Identity);
FormsAuthenticationTicket ticket;
ticket=id.Ticket;
string userdata=ticket.UserData;
string[] roles = userdata.Split(new string[] { "," },StringSplitOptions.None);
HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles);
}
}
}
}

static string cadena = "Data Source=.;Initial Catalog=HOSPITALES;Integrated Security=True";
SqlCommand com = new SqlCommand();
SqlConnection cn = new SqlConnection(cadena);
SqlDataReader lector;

protected void Page_Load(object sender, EventArgs e)
{
com.Connection = cn;
com.CommandType = CommandType.Text;

}
protected void lnknuevo_Click(object sender, EventArgs e)
{
Server.Transfer("nuevousuario.aspx");
}
protected void lnkentrar_Click(object sender, EventArgs e)
{
string grupo;
SqlParameter usu=new SqlParameter();
SqlParameter pass=new SqlParameter();
usu.ParameterName="@usuario";
usu.Value=this.txtusuario.Text;
pass.ParameterName="@password";
pass.Value=this.txtpassword.Text;;
com.Parameters.Add(usu);
com.Parameters.Add(pass);
com.CommandText = "SELECT * FROM USUARIOS "
+ "WHERE USUARIO=@USUARIO AND PASSWORD=@PASSWORD";
cn.Open();
lector=com.ExecuteReader();
bool uservalido=lector.HasRows;
if (uservalido==true)
{
lector.Read();
grupo = lector.GetString(3);
lector.Close();
cn.Close();
FormsAuthenticationTicket ticket=
new FormsAuthenticationTicket(1,this.txtusuario.Text
,DateTime.Now,DateTime.Now.AddMinutes(3)
,true,grupo,FormsAuthentication.FormsCookiePath);

string datoscifrados=FormsAuthentication.Encrypt(ticket);
HttpCookie galleta=
new HttpCookie(FormsAuthentication.FormsCookieName,datoscifrados);
this.Response.Cookies.Add(galleta);
string pagina=
FormsAuthentication.GetRedirectUrl(this.txtusuario.Text,true);
Server.Transfer(pagina);

this.lblmsj.Visible = false;
}
else{
lector.Close();
cn.Close();
this.lblmsj.Text="USUARIO NO AUTORIZADO";
this.lblmsj.Visible = true;
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder