0

3.5frameworkで2つのasp.netWebプロジェクトに取り組んでいます。

Response.Redirectを使用して、クエリ文字列を使用してデータを渡すことで他のページにリダイレクトしましたが、同じアプリケーションで正常に機能していますが、他のアプリケーションにリダイレクトするとエラーが発生します。コード:

(同じプロジェクトの作業コード)

Response.Redirect("confirm_book.aspx?Data=" + Server.UrlEncode(txtfname.Text) + "&Data1=" + Server.UrlEncode(txtlname.Text));

(代わりに他のWebサイトにリダイレクトするときにコードが機能しない)

Response.Redirect("http://abc.com/confirm_book.aspx?Data=" + Server.UrlEncode(txtfname.Text) + "&Data1=" + Server.UrlEncode(txtlname.Text));

(confirm_book.aspxページ読み込みイベントで)

string fname=Request.QueryString["Data"];
string lname=Request.QueryString["Data1"];
4

2 に答える 2

2

確かに、別のアプリケーションにリダイレクトできます。絶対アドレスを指定する必要があります。

Response.Redirect("http://www.example.com/foo.aspx?Data=" + Server.UrlEncode(txtfname.Text));
于 2013-02-08T07:18:49.240 に答える
0

could you put the code of the Page_Load of the application you are redirect to ?

i think you are trying to get a QueryString from the URL that it doesn't exist or NULL value. you may want to check first if the value of the QueryString not NULL

if (Request.QueryString["Data"] != null){

string fname=Request.QueryString["Data"];
// do your logic here !
} else {
// the value is NULL , do error logic here
}

and make this with every QueryString .

于 2013-02-08T07:56:25.213 に答える