2010-08-13 2 views
2
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title></title> 
</head> 
<body> 
    <form id="form1" runat="server" method="post"> 
    <div> 

    </div> 
    </form> 
</body> 
</html> 



namespace WebApplication1 
{ 
    public partial class _Default : System.Web.UI.Page 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      Response.Redirect("/WebForm1.aspx?ID=100"); 
     } 
    } 
} 

두 번째 페이지쿼리 문자열 값을 사용하여 POST 방식 asp.net

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title></title> 
</head> 
<body> 
    <form id="form1" runat="server" method="post"> 
    <div> 

    </div> 
    </form> 
</body> 
</html> 

    protected void Page_Load(object sender, EventArgs e) 
      { 
       string ID = Request.QueryString["ID"].ToString(); 
      } 

내가 포스트 방법을 사용하여 쿼리 문자열 값을 얻기 위해 노력하고 있지만, 값이 검색되지 않습니다.

+0

무슨 오류가 않았다

확인을 제발 도와주세요? id가 없을 때 null이 될 수 있습니까? – Aristos

+0

테스트 질문이 아닙니다. 때로는 값이 전달되지 않고 url에 querystring이 추가되는 경우도 있습니다. –

+0

querystring 값은 여전히 ​​URL에 표시됩니다. –

답변

1

또는 시도

string ID = Request.Params.Get("ID"); 
관련 문제