Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Language Used

Status
Not open for further replies.

Lambro

Programmer
Aug 22, 2001
258
US
One the top of the page I'm trying to add some code is:
<%@language="javascript"%>


The code I'm trying to add is:

<%
if not session("userinfo")="" then
%>

xxxx


<%
else
response.redirect "%>
<%end if%>



It keeps erroring out by giving me the following error:

Error Type:
Microsoft JScript compilation (0x800A03ED)
Expected '('


Is there a way to check a session variable and redirect to a page if there's no session variable

When I use this code in my asp page with <%@LANGUAGE="VBSCRIPT"%> at the top, it works fine but I need it to work with <%@language="javascript"%> at the top.
 
It is because you are telling the page that you are using javascript for your code, then you proceed to code in VBScript. If you must use javascript, then you need to code in javascript. This is VBScript, not javascript:
Code:
<%
if not session("userinfo")="" then
%>
You will need to change it to the correct javascript syntax if you expect it to work without erroring.

------------------------------------------------------------------------------------------------------------------------
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair."
--Dou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top