在ASP.NET C#表单中获取和发布参数 [英] Get and post parameters in ASP.NET C# forms

查看:92
本文介绍了在ASP.NET C#表单中获取和发布参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我从网址获取名为'auth_token'的参数,需要将其发回给另一个网址。



< form action =https://easypay.easypaisa.com.pk/easypay/Confirm.jsfmethod =POSTtarget =_ blank >

< input name =auth_tokenvalue =hidden =true/>

< input name =postBackURLvalue =http ://www.my.online-store.com/transaction/MessageHandler1hidden =true/>

< input value =confirmtype =submitname =pay />

< / form>



代码确实获取并传递参数,因为它适用于php。在这方面有谁能帮助我。



我尝试过:



我尝试了不同的方法来获取并传递参数但没有任何效果。

解决方案

检查此代码可能对您有用

< br $>


无效Page_Load(){



string auth_token = Request.QueryString(auth_token);



string postForm =< center style ='font-family:Verdana; font-size:13px; margin-top:200px;'>< p> Please等待,传输数据....< / p>< / center> +

< form action ='http://www.my.online-store.com/transaction/MessageHandler1'methation ='post'ID ='Form1'name ='Form1'> ;

< input type ='hidden'name ='auth_token'value ='+ auth_token +'ID ='auth_token'> +

< / form>< script> document.Form1.submit();< / script>;

Response.Clear();

Response.Write(postForm);

Response.Flush();

Response.End();

}

Hi,

I am getting parameter named 'auth_token' from a url and need to post it back to another url.

<form action=" https://easypay.easypaisa.com.pk/easypay/Confirm.jsf " method="POST" target="_blank">
<input name="auth_token" value="" hidden = "true"/>
<input name="postBackURL" value=" http://www.my.online-store.com/transaction/MessageHandler1" hidden ="true"/>
<input value="confirm" type = "submit" name= "pay"/>
</form>

The code does get and pass the parameter because it is for php. Can anyone help me in this regard.

What I have tried:

I tried different ways to get and pass the parameter but nothing work.

解决方案

Check this code may be useful to you


Void Page_Load(){

string auth_token = Request.QueryString("auth_token");

string postForm = "<center style='font-family:Verdana; font-size:13px; margin-top:200px;'><p>Please Wait, Transferring data….</p></center>" +
"<form action='http://www.my.online-store.com/transaction/MessageHandler1' method='post' ID='Form1' name='Form1'>"
"<input type='hidden' name='auth_token' value='" + auth_token + "' ID='auth_token'>" +
"</form><script>document.Form1.submit();</script> ";
Response.Clear();
Response.Write(postForm);
Response.Flush();
Response.End();
}


这篇关于在ASP.NET C#表单中获取和发布参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆