当前位置:编程学习 > C#/ASP.NET >>

<a href='B.aspx?photoid=<%#Eval("photoid")%>'>图片</a> 请问在B页面如果接受穿过来的值?

RT,感谢大大们 --------------------编程问答-------------------- Request["photoid"] --------------------编程问答--------------------

Request.QueryString["photoid"]
--------------------编程问答-------------------- if(Request.QueryString["photoid"]!=null)
{
     string photoId = Request.QueryString["photoid"].ToString();
     int photoid;
     if(int.TryParse(photoId ,out photoid))
     {
            photoid 才是你要的值;
            多做点判断,防止SQL注入
     }
}
--------------------编程问答-------------------- int photoid=Convert.Toint32(Request.QueryString["Photoid"]); --------------------编程问答-------------------- Request.QueryString["photoid"]
如果是中文家 server。urlencode urldecode --------------------编程问答--------------------
引用 3 楼 zmm12 的回复:
if(Request.QueryString["photoid"]!=null)
{
  string photoId = Request.QueryString["photoid"].ToString();
  int photoid;
  if(int.TryParse(photoId ,out photoid))
  {
  photoid 才是你要的值;
  多做点判断,防止……


还是这个好 --------------------编程问答--------------------
引用 3 楼 zmm12 的回复:
if(Request.QueryString["photoid"]!=null)
{
  string photoId = Request.QueryString["photoid"].ToString();
  int photoid;
  if(int.TryParse(photoId ,out photoid))
  {
  photoid 才是你要的值;
  多做点判断,防止……

高!!! --------------------编程问答-------------------- 看楼上的 --------------------编程问答-------------------- 楼上已有正解 --------------------编程问答-------------------- 后台定义一可访问性足够属性,取值做安全验证
 不显示删除回复显示所有回复显示星级回复显示得分回复 <a href='B.aspx?photoid=<%=属性名)%>'>图片</a>
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,