Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否可以访问在xamarin forms应用程序上使用会话的网页?_C#_Xamarin_Xamarin.forms - Fatal编程技术网

C# 是否可以访问在xamarin forms应用程序上使用会话的网页?

C# 是否可以访问在xamarin forms应用程序上使用会话的网页?,c#,xamarin,xamarin.forms,C#,Xamarin,Xamarin.forms,我有一个网页(…/ui/mydashboard.aspx),我想在我的xamarin forms应用程序上显示该网页,问题是该网页没有使用查询参数为用户提供身份验证详细信息。是否可以访问该网页(…/ui/mydashboard.aspx),而不必通过我的移动应用程序中的登录页 public Dashboard () { InitializeComponent (); webView.Source = "http://dev.webapp.com/ui

我有一个网页(…/ui/mydashboard.aspx),我想在我的xamarin forms应用程序上显示该网页,问题是该网页没有使用查询参数为用户提供身份验证详细信息。是否可以访问该网页(…/ui/mydashboard.aspx),而不必通过我的移动应用程序中的登录页

   public Dashboard ()
    {
        InitializeComponent ();
        webView.Source = "http://dev.webapp.com/ui/mydashboard.aspx";

    }

您可以将数据作为post请求的主体发送。如果您不想让用户输入数据,可以设置默认值

HttpClient client = new HttpClient() { Timeout = TimeSpan.FromSeconds(30) };

// set the params here
HttpContent content = new StringContent(JsonConvert.SerializeObject(objectToPost), Encoding.UTF8, "application/x-www-form-urlencoded");

var response = await client.PostAsync(new Uri("http://your.url"), content);

if (response.IsSuccessStatusCode) {
    var responseFromServer = await response.Content.ReadAsStringAsync();
}
else {
    // handle errors
}

如果您的网站需要身份验证,则您需要提供此信息。您可以使用应用程序的用户凭据获取网站的令牌,如果它们是相同的凭据,则需要进行身份验证。