我在WebBrowser和c#中的终端有问题,我无法处理打开链接,
string link = "https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull%20[107404]\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6";
this.webb.Navigate(link, null, null, "User-Agent: ..."); or the same link,
来自windows和android浏览器的响应
ok ["Piraci z Karaibów: Skrzynia umarlaka","Pirates of the Caribbean: Dead Man's Chest",7.83812,222891,"Fantasy,Przygodowy",2006,150,119,"http://www.filmweb.pl/Skrzynia.Umarlaka/discussion",1,1,"/74/04/107404/7518098.2.jpg",null,"2006-06-24","2006-07-21",0,0,0,"USA","Jack Sparrow musi spłacić dług zaciągnięty wobec kapitana Latającego Holendra. Uniknie śmierci, gdy znajdzie i zniszczy serce Davy'ego Jonesa ukryte w Skrzyni Umarlaka."] t:43200
来自WPF或控制台的响应
err 10, Signature value is incorrect
请帮助解决问题
我的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Filmweb
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var webb = new WebBrowser();
var link = "https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull%20[107404]\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6";
this.webb.Navigate(link);
}
}
}
XAML
<Window x:Class="Filmweb.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<WebBrowser x:Name="webb" HorizontalAlignment="Left" Height="319" VerticalAlignment="Top" Width="517"/>
</Grid>
防火墙被禁用,代码似乎是正确的,仍然无法正常工作,可能导致其他地方的谎言?
Visual Studio Express 2013
答案 0 :(得分:5)
您的问题与您的网址字符串中的\n
有关。
<强>作品强>
var url = @"https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull%20[107404]\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6";
var res = new WebClient().DownloadString(url);
不起作用(错误10,签名值不正确)
var url = "https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull%20[107404]\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6";
var res = new WebClient().DownloadString(url);
您只需 @
:)
请参阅: String literals
答案 1 :(得分:0)
所以您只需要使用其他斜杠来转义\n
符号:https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull [107404]\\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6