Sevron
asked on
Classic ASP If statement not working
if session("pkContactID")<>request("pkContactID") or session("userlevel")<>"4" then
%>
You do not have sufficient permissions to edit this account!
<%
else
end if
We have a problem with the conditional statement above, it is not going into the else part of the statement.
I have checked the values for the session("pkContactID") and request("pkContactID") and they are the same but yet it sill does not go into the else.
When I dont have the or clause and just check session("userlevel") it goes into the else but as soon as I include the additional or condition it fails.
Am I missing some logic or is ASP being quirky?
If anyone can help that would be awesome.
Thanks.
<%If Session("pkContactID") ..........................................then %>
You do not have sufficient permissions to edit this account!
<%Else%>
WHAT ELSE
<%End If%>
sElvol
ASKER
Hi thanks for the reply.
We tried that also however it did not help.
We tried that also however it did not help.
it might be you are trying to compare string and numbers
try this
Cstr(session("pkContactID" ))<>Cstr(( request("p kContactID "))
try this
Cstr(session("pkContactID"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I managed to fix it with the following code.
By Using Trim and Cstr and also changing the or to an and.
By Using Trim and Cstr and also changing the or to an and.
if session("userlevel")<>"4" and Trim(CStr(session("pkContactID")))<>Trim(CStr(request("pkContactID"))) then
%>
You do not have sufficient permissions to edit this account!
<%
else
end if
if (Trim(session("pkContactID
%>
You do not have sufficient permissions to edit this account!
<%
else
end if