简体   繁体   English

Facebook C# SDK - Mobile Web Page: Facebook Wall Post URL Redirect

[英]Facebook C# SDK - Mobile Web Page : Facebook Wall Post URL Redirect

I am currently working on a mobile web page in asp.Net MVC2 that allows users to post to their walls.我目前正在asp.Net MVC2中的移动web页面上工作,该页面允许用户发布到他们的墙上。 I have the following code that posts to the user's wall, but would like to instead have a redirect to Facebook's mobile "Post To my Wall" view to allow the user to add to the posted message and submit with a "Post" button or "Cancel".我有以下代码发布到用户的墙上,但希望重定向到 Facebook 的移动“发布到我的墙上”视图,以允许用户添加到发布的消息并使用“发布”按钮或“取消”。 Do I have to recreate this view myself?我必须自己重新创建这个视图吗? It seems like something that a lot of sites would use.这似乎是很多网站都会使用的东西。

 public string PostToWall(string code)
        {
            string authToken = string.Empty;
            try
            {
                authToken = GetAuthToken(code);
                FacebookClient app = new FacebookClient(authToken);
                dynamic user = app.Get("me");
                var id = user.id;
                var args = new Dictionary<string, object>();
                args["message"] = "Test Wall Post";
                args["caption"] = "Test Caption";
                args["description"] = "Test Description";
                args["name"] = "Test Name";
                //args["picture"] = "[your image URL]";
                //args["link"] = "[your link URL]";

                app.Post("/me/feed", args);
                return string.Empty;

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Error getting the Facebook authentication token. {0}", ex);
                return string.Empty;
            }
        }

Thanks!谢谢!

[Edit] @OffBySome I set up a rough test using the facebook Javascript SDK and I set it to display: 'touch' but it still pops up in my safari iphone user agent. [Edit] @OffBySome I set up a rough test using the facebook Javascript SDK and I set it to display: 'touch' but it still pops up in my safari iphone user agent. I used this我用这个

attachment: {
                title: '<my title>',
                caption: '<my caption>',
                description: (
                        <my description>
                    ),
                name: '<name>',
                link:  '<link>',
                display: 'touch', },

But none of these attachments get added to my wall posts.但是这些附件都没有添加到我的墙贴中。 Am I doing it wrong?我做错了吗? Dialogs: Fb.Ui http://developers.facebook.com/docs/reference/javascript/#xfbml对话:Fb.Ui http://developers.facebook.com/docs/reference/javascript/#xfbml

Easiest for this would be to use the Facebook javascript sdk and use the FB.ui dialog to allow the user to share.最简单的方法是使用Facebook javascript sdk 并使用FB.ui 对话框允许用户共享。 You can set display=touch or display=wap for a mobile optimized dialog.您可以为移动优化对话框设置 display=touch 或 display=wap。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM