แนวๆ นี้แหละ error หรือเปล่าก็ไม่รู้ เพราะไม่ได้จับ asp มานาน แล้วก็โค้ดสด
index.asp
<%
If IsNull(Session("UserID")) Then
Response.Write("<input type=""button"" value=""Login"" onClick=""javascript:window.open('/login.asp','login','scrollbars=yes,width=550,height=350').focus();"" />")
Else
Response.Redirect("/main.asp")
End If
%>
login.asp
<%
If Not IsNull(Request.Form("username")) And Not IsNull(Request.Form("password")) Then
Set Rs = Conn.Execute("Select * From [UserTable] Where [UserName]='" & Request.Form("username") & "' And [Password]='" & Request.Form("password") & "'")
If Not Rs.Eof Then
Session("UserID") = Rs("UserID")
%>
<script language="JavaScript">
window.parent.reload();
</script>
<%
End If
End If
%>
<form name="form1" method="post">
<input type="text" name="username" />
<br />
<input type="password" name="password" />
<br />
<input type="submit" value="Login">
</form>