Mi primer post

. Bien estamos con el proyecto de un blog en asp y me ha tocado la parte de validar si el usuario es admin. Este es el codigo y asi a rasgos generales llama a un procedimiento almacenado que devuelve los valores de la tabla del usuario. Si es admin tengo que cambiar las variables de sesion "administrador" y "usuario" y redirecionar a "admin_option.asp", si se produce un error tengo que redireccionar a "mesaje.asp" y pasarle la descripcion del error("txt"), es esto ultimo lo que no se hacer, es que soy muy novato. Si ven algo que non estea bien no duden en decirmelo, y si no saben por que hago algo pregunten! Codigo:
<%
Option Explicit
Response.expires = 0
session("usuario")= ""
session("administrador") = ""
%>
<%
dim txt
dim url
dim usuario
dim pwd
dim sql, objConnection, objRS
dim strConnection
strConnection = Application("strConnection")
txt = ""
usuario = Request.Form("usr")
pwd = Request.Form("pwd")
if txt="" then
'Comprueba que el usuario ha introducido un nombre
if txt="" and usuario ="" then
txt="No ha introducido ningun usuario"
end if
'Comprueba que el usuarion ha introducido un password
if txt="" and pwd ="" then
txt="No ha introducido ningun password"
end if
end if
if txt="" then
'Creamos la conexion
set objConnection =Server.CreateObject("ADODB.Connection")
if err.number<>0 then
txt= "Error al crear la conexion"
end if
end if
if txt="" then
'Creamos el recordset
set objRS =Server.CreateObject("ADODB.Recordset")
if err.number<>0 then
txt= "Error al crear el recordset"
end if
end if
if txt="" then
'Establecemos la consulta( llamada al procedimiento)
sql= "US_validacion'"&usuario&"','"&pwd&"'"
end if
if txt="" then
'Abrimos la conexión
set objConnection.ConnectionString=strConnection
objConnection.Open()
if err.number<>0 then
txt= "Error al abrir la conexion " & err.descripcion
end if
end if
if txt="" then
'Ejecutamos el procedimiento almacenado
objRS.open sql, objConnection
if err.number<>0 then
txt="Error al ejecutar la consulta "& err.decripcion
end if
end if
if txt="" then
'Comprobacion de que el usuario exita
if objRS.EOF = true then
txt="Este usuario no existe"
end if
end if
if txt="" then
'Comprobar que el usuario es administrador
if lcase(objRS.Fields("US_tipo"))= "a" then
session("administrador") = "S"
session("usuario")=usuario
end if
end if
if txt="" then
'Si es administrador
if session("administrador") = "S" then
Response.Redirect "admin_option.asp"
end if
end if
if txt<>"" then
'Si se ha producido algun error
Response.Redirect "mensaje.asp"
end if
objRS.close()
set objRS = nothing
set objConnection = nothing
%>
Salu2 y Gracias!