日期:2014-05-20  浏览次数:20428 次

Request的问题??????????????????
Response.Redirect( "webform2.aspx?aa=#&bb=567 ");
这样写在webform2中可以得到 aa和bb的值
但是Response.Redirect( "webform2.aspx?aa=#&bb=# ");
这样写就得不到bb的值了 怎么 样才能得到bb的值呢?

------解决方案--------------------
把#号去掉试试看
------解决方案--------------------
Response.Redirect( "webform2.aspx?aa= "+Server.UrlEncode( "# ")+ "&bb= " +Server.UrlEnCode( "# ");
------解决方案--------------------
Request.QueryString[ "bb "]
你是这样写的吗
------解决方案--------------------
Response.Redirect(Server.UrlEncode( "webform2.aspx?aa=#&bb=# "));试一试
------解决方案--------------------
#号在url中表示锚点.
------解决方案--------------------
#& 这个没有记错好像就是转义字符啊 #&13; charCode 语义有问题
最后一个# 的确是锚点
建议还是不要用这么怪怪的参数比较好了
------解决方案--------------------
利用反射,给一段例子给你.


string sClass = CCConvert.GetRequsetQueryString( "ClassName "); string sMethodName = "GetReports "; //得到类 Type oType = System.Type.GetType( "Report.Class. "+sClass); if(oType == null ) { Response.Write( "类: "+sClass + "不存在! "); return; } //实现化 object oInst = Activator.CreateInstance(oType); if(oInst ==null) { Response.Write( "类: "+sClass + "不存在! "); return; } //得到方法 MethodInfo oMethod = oType.GetMethod(sMethodName); if(oMethod ==null) { Response.Write( "方法: "+ sMethodName + "不存在! "); return ; } int iParamsCount = oMethod.GetParameters().Length; string sParams = CCConvert.GetRequsetQueryString( "Params "); string[] ary = sParams.Split( ', '); if(ary.Length !=iParamsCount) { Response.Write(String.Format( "传入的参数的个数{0}不等于该方法{1}实际的参数个数{2},请检查 ",ary.Length.ToString(),oMethod.Name,iParamsCount.ToString())); return; } //得到属性 PropertyInfo Pro = oType.GetProperty( "Title "); this.sTitle = Pro.GetValue(oInst,null).ToString(); FieldInfo fldFileName = oType.GetField( "sExcelFileName "); string sHTML = oMethod.Invoke(oInst,BindingFlags.Public,Type.DefaultBinder,ary,null).ToString(); string sFileName = fldFileName.GetValue(oInst).ToString(); //Response.Write(sFileName);
------解决方案--------------------
Response.Redirect( "webform2.aspx?bb=567&aa=# ");
这么写
------解决方案--------------------
不能要#
------解决方案--------------------
如果要#的话,就取不出来。
你可以这样a= a.Replace( "# ", "%23 ");等等来转换一下。
------解决方案--------------------
Server.UrlEnCode不可以吗?