【问题标题】:ASP.Net - get querystring of page that has been redirected toASP.Net - 获取已重定向到的页面的查询字符串
【发布时间】:2013-09-03 22:51:12
【问题描述】:

以下代码:

 WebRequest request = WebRequest.Create("http://localhost/sandbox/htmlpage1.htm");

 WebResponse response = request.GetResponse();

 string url = ((HttpWebResponse)response).ResponseUri.ToString();

正在请求 htmlpage1.html,而后者又重定向到另一个页面 (otherpage.htm?qs=data)。如何从 htmlpage1.htm 以编程方式重定向到的“其他页面”获取查询字符串。这是来自 winforms 应用程序的 LinkedIn OAuth2 例程。我需要 url 变量来给我 otherpage.htm 而不是 htmlpage1.htm 的查询字符串。任何帮助将不胜感激。

【问题讨论】:

    标签: asp.net http oauth request


    【解决方案1】:

    在 ASP.Net 中我们可以使用

    获取查询字符串

    c# : Request.QueryString[""] 。说你的情况可能是

    Request.QueryString["qs"].

    【讨论】:

    • 谢谢,但不是我要的。这是一个不基于浏览器的窗体应用程序。
    猜你喜欢
    • 2014-04-06
    • 1970-01-01
    • 2016-04-25
    • 2016-02-11
    • 2020-12-14
    • 2015-08-05
    • 2014-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多