页面中的cookies读写,很基础
这样可以显示
Response.Cookies( "userName ").Value = "patrick "
Response.Cookies( "userName ").Expires = DateTime.Now.AddDays(1)
response.write( " <br> 12 "&request.Cookies( "userName ").Value)
这样就不可以显示
Response.Cookies( "userName ").Value = "patrick "
Response.Cookies( "userName ").Expires = DateTime.Now.AddDays(1)
response.write( " <br> 12 "&request.Cookies( "userName ").Value& "-- ")
提示
编译器错误信息: BC30277: 类型字符“&”与声明的数据类型“String”不匹配。
源错误:
行 37: Response.Cookies( "userName ").Expires = DateTime.Now.AddDays(1)
行 38:
行 39: response.write( " <br> 12 "&request.Cookies( "userName ").Value& "-- ")
行 40:
行 41:
怎么前面可以&字符,后面就不能&字符呢?
------解决方案--------------------Response.Write( " <br> 12 " & Request.Cookies( "userName ").Value & "-- ")
空格
------解决方案--------------------楼主想必用的不是C#?
C# 里面字符串连接用 +
或者Response.Write(String.Format( " <br> 12{0}-- ",request.Cookies( "userName ").Value));