string app = Request.QueryString["app"] == null ? "ucenter" : Request.QueryString["app"];
就这句代码获取URL参数app
对于字符串参数,如?app=abc,则获取到的app为空值""
对于数值型参数,如?app=123,则能正常获取到,
是不是与我的web应用程序设置有关呢?实在想不通

解决方案 »

  1.   

    补充下 Request.QueryString["app"] 和Request["app"] 两种方法我都试了,都是同样的问题我调试了两个Request属性
    RawUrl = "/Home.aspx?app=abc"
    Url = {http://localhost:61771/Home.aspx?app=}
      

  2.   

    都用 mvc 了,url 不应该是 http://localhost:61771/Home/Index/123 嘛
      

  3.   

    试试:
    string app = (Request.QueryString["app"] == null) ? "ucenter" : Request.QueryString["app"].ToString();
      

  4.   

    Sorry,找到原因了,居然在Global.asax里面,Application_BeginRequest对URL参数过滤的判断逻辑有问题,对Url使用Context.RewritePath(Url);重定向了