Type mismatch when comparing session variable to page variable 
Author Message
 Type mismatch when comparing session variable to page variable

I have a page which dynamically displays one user's data at a time.  I wish
that user 1234 be allowed access only to personaldata.asp?User=1234 .

I set a session variable - Session("UserID") when a user logs in to my site
and I wish to compare the ?User=BEID in my query string to
Session("UserID").

I'm getting a type mismatch when I do the following, even though both
variables Response.Write the same number.

What simple item am I missing here?

<%
intBEID = Request.QueryString("BEID")
intUserID = Session("UserID")
If intBEID=intUserID Then ' type mismatch error at this line
 Response.write "this finally stinking worked"
 Response.End
End If
%>

Thanks,
Kurt



Sun, 30 Dec 2001 03:00:00 GMT  
 Type mismatch when comparing session variable to page variable


Fri, 19 Jun 1992 00:00:00 GMT  
 Type mismatch when comparing session variable to page variable
This did the trick:

intBEID=CInt(Request.QueryString("BEID"))

Sorry for posting early.

Kurt


Quote:
> I have a page which dynamically displays one user's data at a time.  I
wish
> that user 1234 be allowed access only to personaldata.asp?User=1234 .

> I set a session variable - Session("UserID") when a user logs in to my
site
> and I wish to compare the ?User=BEID in my query string to
> Session("UserID").

> I'm getting a type mismatch when I do the following, even though both
> variables Response.Write the same number.

> What simple item am I missing here?

> <%
> intBEID = Request.QueryString("BEID")
> intUserID = Session("UserID")
> If intBEID=intUserID Then ' type mismatch error at this line
>  Response.write "this finally stinking worked"
>  Response.End
> End If
> %>

> Thanks,
> Kurt



Sun, 30 Dec 2001 03:00:00 GMT  
 Type mismatch when comparing session variable to page variable


Fri, 19 Jun 1992 00:00:00 GMT  
 Type mismatch when comparing session variable to page variable
Kurt,

intBEID is a string

intUserID is an integer

Nic Roche
Net Extra
www.extra.net.au


Quote:
>I have a page which dynamically displays one user's data at a time.  I wish
>that user 1234 be allowed access only to personaldata.asp?User=1234 .

>I set a session variable - Session("UserID") when a user logs in to my site
>and I wish to compare the ?User=BEID in my query string to
>Session("UserID").

>I'm getting a type mismatch when I do the following, even though both
>variables Response.Write the same number.

>What simple item am I missing here?

><%
>intBEID = Request.QueryString("BEID")
>intUserID = Session("UserID")
>If intBEID=intUserID Then ' type mismatch error at this line
> Response.write "this finally stinking worked"
> Response.End
>End If
>%>

>Thanks,
>Kurt



Mon, 31 Dec 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Variable Type Mismatch

2. Type Mismatch error sending array or recordset variables to MTS from ASP

3. dotnet Session variable set too late - Error Page Description related

4. Session Variables Always lost when page is loaded

5. Splitting Session Variable into several variables (array?)

6. Largest Variable for the Long variable type

7. The value of a variable (String type) is the name of a variable

8. Cannot assign a variable declared as a string to a variable declared as data type

9. Variable type of variable?

10. Lose Session variables recursing page

11. "Session variable expire by refreshing the page"?true:false

12. Page Count Session Variable

 

 
Powered by phpBB® Forum Software