I have a project with a few pages. The problem is that I don't want to allow the user to be able to view a page without first login in. The problem is with the edit.aspx page. If receives and sends a querystring such as http://www.mysite.co.il/editAd.asp?a...id=8&sub_id=25
Now if i enter the above querystring in the address toolbar of my browser it takes me to that edit page without prompting for a login password and username. I want to prevent it. If a user doesn't first login then he shouldn't be able to view his page. How can i do it?
If I just enter http://www.mysite.co.il/editAd.asp
then login fails (that is good)
I thought that the following code should do it but it doesn't:
By the way Myads.asp is the page before edit.aspx (both codes are attached in the file called code).
*** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
If MM_valUsername <> "" Then
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_connDUclassified_STRING
MM_rsUser.Source = "SELECT U_ID, U_PASSWORD"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM USERS WHERE U_ID='" & MM_valUsername &"' AND U_PASSWORD='" & CStr(Request.Form("Password")) & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization ).Value)
Session("MM_UserAuthorization") = ""
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")