iframe标签未显示C#
我试图将视频上传到Wordpress.using以下方法iframe标签未显示C#
string expression = videoData.VideoTitle;
string str7 = videoData.VideoTitle;
WebClient client = new WebClient();
client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
string s = "security_code=JGZpbGVu&post_content=<iframe width='480' height='390' src='http://www.youtube.com/embed/XkIdmC8MlkI' frameborder='0' allowfullscreen></iframe>"
+ "&post_title=" + expression + "&post_category="
+ "&post_category=" + category + "&category=" + category + "&post_name=" + str7 + "&post_date=" + DATE_STRING;
byte[] bytes = Encoding.ASCII.GetBytes(s);
byte[] buffer2 = client.UploadData(uploadPath, "POST", bytes);
string str8 = Encoding.ASCII.GetString(buffer2).ToString();
它的工作原理,一切都贴出但在标签的东西没有得到贴我尝试了一些夫妇的事情什么结果out是它有标签问题。 当我删除iframetag的<它显示,但直到url和之后,一切都消失了。 这里是不执行以及
"security_code=JGZpbGVu&post_content=test iframe width='480' height='390' src='http://www.youtube.com/embed/XkIdmC8MlkI' frameborder='0' allowfullscreen></iframe>&post_title=How to build, upgrade, or repair, your own PC Computer&post_category=&post_category=asd&category=asd&post_name=How to build, upgrade, or repair, your own PC Computer&post_date=2011-05-11 00:00:00"
任何想法的东西有什么不好?
您可能需要登录URL-encode HTML。
确保您引用的System.Web,则:
string html = @"<iframe width='480' height='390' src='http://www.youtube.com/embed/XkIdmC8MlkI' frameborder='0' allowfullscreen></iframe>";
string s = string.Format("security_code=JGZpbGVu&post_content={0}&post_title={1}&post_category={2}&category={3}&post_name={4}&post_date={5}", System.Web.HttpUtility.UrlEncode(html), expression, category, category, str7, DATE_STRING);
时已经显示''client.Headers.Add(“Content-Type”,“application/x-www-form-urlencoded”);' – 2011-05-10 19:43:57
@Afnan:你需要实际对URL进行URL编码,看到更新的答案。 – svinto 2011-05-10 20:23:35
不,即使这并没有帮助 – 2011-05-10 20:48:07
我们可以看到,当这贴_is_生成HTML是什么? – Chad 2011-05-10 19:19:34
Html在字符串s? – 2011-05-10 19:24:11
@Afnan就像你打这个电话后,访问你的Wordpress驱动的网站,你看到新帖子是正确的?复制该页面的HTML(最好只是有问题的部分)并发布给我们看。 – Chad 2011-05-10 19:26:24