如何在响应中检索请求的参数 [英] How to retrive the requested parameter in responce

查看:131
本文介绍了如何在响应中检索请求的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我想在响应页面中检索参数,如何才能检索到该参数.

我尝试过的事情:

在我的课堂上,我正在向asp.net页面发送一些参数.

hello i wanted to retrieve the parameter in response page how can retrieve this.

What I have tried:

here from my class i am sending some parameter to the asp.net page.

string email = "YOUR EMAIL";
           string password = "YOUR PASSWORD";

           string URLAuth = "http://localhost:2013/Default.aspx";
           string postString = string.Format("name={0}&inputPassword={1}", email, password);

           const string contentType = "application/x-www-form-urlencoded";
           System.Net.ServicePointManager.Expect100Continue = false;

           CookieContainer cookies = new CookieContainer();
           HttpWebRequest webRequest = WebRequest.Create(URLAuth) as HttpWebRequest;
           webRequest.Method = "POST";
           webRequest.ContentType = contentType;
           webRequest.CookieContainer = cookies;
           webRequest.ContentLength = postString.Length;
           webRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
           webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";

           StreamWriter requestWriter = new StreamWriter(webRequest.GetRequestStream());
           requestWriter.Write(postString);
           requestWriter.Close();

           StreamReader responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
           string responseData = responseReader.ReadToEnd();

           responseReader.Close();
           webRequest.GetResponse().Close();



我想在default.aspx



and i want to retrieve this parameter in default.aspx

推荐答案

string user = Request.Form["name"];
string password = Request.Form["inputPassword"];


这篇关于如何在响应中检索请求的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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