vb.net - System.Web.HttpCookie Cannot be converted to Integer -
i can logged in users id when try pass cookie query getting above error. how can convert value? in table value (d606e50f-0a5c-42d6-a8eb-4219465e8a5e)
dim myobject membershipuser = membership.getuser() dim userid string = myobject.provideruserkey.tostring() dim cookieuser httpcookie = new httpcookie("userid") cookieuser.value = userid.tostring() response.cookies.add(cookieuser) dim ds dataset ds = u.runquery("select [firstname], [lastname], [email], [phone] aspnet_users @userid = "(cookieuser)) firstnametextbox.text = ds.tables(0).rows(0)("firstname") lastnametextbox.text = ds.tables(0).rows(0)("lastname") emailtextbox.text = ds.tables(0).rows(0)("email") phonetextbox.text = ds.tables(0).rows(0)("phone")
thanks!
the problem following
userid = "(cookieuser)
vb.net seeing string constant followed (value)
treats index string. hence tries interpret cookieuser
integer
, fails. looks trying concatenate strings here , if following
userid = " & cookieuser
note seemingly opens sql injection attack though. better use query builder , sanitize inputs using raw string concatenation build sql queries
Comments
Post a Comment