2
任何人都可以指示我如何在MVC应用程序中使用Facebook C#SDK的表单发布方式吗?这是一个基于iframe的Canvas应用程序。Form Post with Facebook C#SDK
我有以下代码
[HttpPost, CanvasAuthorize(Permissions = "publish_stream")]
public ActionResult Enter(FormCollection col)
{
var fbApp = new FacebookClient(this.CurrentSession.AccessToken);
JsonObject result = (JsonObject)fbApp.Get("me");
long FacebookId = long.Parse(result["id"].ToString());
//CODE TO INSERT GOES HERE
return View();
}
而且形式是这样的
<form action="/EnterComp/Enter" enctype="multipart/form-data" method="post">
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<label for="Text">Text</label>
</div>
<div class="editor-field">
<input id="Text" name="Text" type="text" value="" />
</div>
<div class="editor-label">
<label for="ImagePath">ImagePath</label>
</div>
<div class="editor-field">
<input type="file" name="ImagePath" id="ImagePath">
</div>
<div class="editor-label">
<label for="VideoPath">VideoPath</label>
</div>
<div class="editor-field">
<input type="file" name="VideoPath" id="VideoPath">
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
</form>
但每次我提交表单,它似乎要重新验证 - 从而失去形式收集。现在我确信有一些非常简单的东西我错过了,任何帮助将不胜感激。
编辑
我想我在这里回答了我自己的问题,但如果任何人我照顾。至少对我来说,解决方案是here。
但是,如果任何人都可以提出其他建议。请帮忙!
这工作的一种享受!非常感谢。 – Roffers 2011-02-14 13:38:47