[英]Open link WebBrowser or console in C#
我在C#中从WebBrowser和终端遇到问题,我无法处理打开链接的问题,
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速成版2013
您的问题与网址字符串中的\\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);
您只需要一个@
:)
参见: 字符串文字
因此,您所需要的只是用\\n
加上斜线来转义\\n
符号: https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull [107404]\\\\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6
: https://ssl.filmweb.pl/api?version=1.0&appId=android&methods=getFilmInfoFull [107404]\\\\n&signature=1.0,abbe0aaf4fcc5c56327c977ee07d72b6
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.