当出现ID=12345678时,跳转到404  如下代码应该怎么改。谢谢if (Request["id"] != null)
                {
                    id = Request["id"].ToString().Trim();                    string result = GetHtml("http://download.csdn.net/source/"+id+".html");                 }

解决方案 »

  1.   

    if (Request["id"] != null&&Request["id"]=="12345678")
                    {
                        Response.Redirect("notfound.aspx");
                     }
    else if(Request["id"]!=null)
    {
    id = Request["id"].ToString().Trim();                    string result = GetHtml("http://download.csdn.net/source/"+id+".html");}
      

  2.   

    if (Request["id"] != null)
                    {
                        id = Request["id"].ToString().Trim();                    string result = id=="12345678"?GetHtml("notfound.aspx"):GetHtml("http://download.csdn.net/source/"+id+".html");                 }
      

  3.   


     string result =Request["id"] != null? GetHtml("http://download.csdn.net/source/"+Request["id"].ToString()+".html"):GetHtml("notfound.aspx");
      

  4.   

    if (Request["id"] != null && Request["id"].ToString() == "12345678")
    {
        Response.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
    }