then i get that tosse cant be converted to a Boolean, and what im trying to do is to
get stat and mail to 2 session in this code, and its the first line im getting the error on.
Im getting the error with and without the .ToString code.
If Request.QueryString("stat") <> Nothing Then
Session("thestat") = Request.QueryString("stat").ToString And Session("themail") = Request.QueryString("mail").ToString
Else
Session("thestat") = "" And Session("themail") = ""
End If
If Request.QueryString("stat") <> Nothing Then
Session("thestat") = Request.QueryString("stat").ToString
Else
Session("thestat") = ""
End If
If Request.QueryString("themail") <> Nothing Then
Session("themail") = Request.QueryString("mail").ToString
Else
Session("themail") = ""
End If
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString("stat") <> Nothing Then
Session("thestat") = Request.QueryString("stat").ToString And Session("themail") = Request.QueryString("mail").ToString
ElseIf Session("thestat") = "" And Session("themail") = ""
Then
End If
End Sub
siraero
Member
419 Points
604 Posts
Boolean error for request.querystring
May 06, 2012 10:45 AM|LINK
Hi
I getting an error when i run this link
mydomail.dk/mypage.aspx?stat=tosse&mail=mail@mail.dk
then i get that tosse cant be converted to a Boolean, and what im trying to do is to
get stat and mail to 2 session in this code, and its the first line im getting the error on.
Im getting the error with and without the .ToString code.
If Request.QueryString("stat") <> Nothing Then Session("thestat") = Request.QueryString("stat").ToString And Session("themail") = Request.QueryString("mail").ToString Else Session("thestat") = "" And Session("themail") = "" End IfCan someone help !?
Ken Tucker
All-Star
16797 Points
2608 Posts
MVP
Re: Boolean error for request.querystring
May 06, 2012 10:59 AM|LINK
Why the and statement? Shouldn't the code be on two lines
Session("thestat") = ""
Session("themail") = ""
Space Coast .Net User Group
chaaraan
Contributor
2170 Points
484 Posts
Re: Boolean error for request.querystring
May 06, 2012 11:02 AM|LINK
Try this
If Request.QueryString("stat") <> Nothing Then
Session("thestat") = Request.QueryString("stat").ToString
Else
Session("thestat") = ""
End If
If Request.QueryString("themail") <> Nothing Then
Session("themail") = Request.QueryString("mail").ToString
Else
Session("themail") = ""
End If
dotnetpree
Member
164 Points
41 Posts
Re: Boolean error for request.querystring
May 07, 2012 04:48 AM|LINK
Just put a "If" and "Then" bolded
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString("stat") <> Nothing Then
Session("thestat") = Request.QueryString("stat").ToString And Session("themail") = Request.QueryString("mail").ToString
ElseIf Session("thestat") = "" And Session("themail") = "" Then
End If
End Sub