<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>johna's blog</title>
<link>https://johna.compoutpost.com/</link>
<description>...mostly about web development and programming, with a little bit of anything else related to the Internet, computers and technology.</description>
<item>
<title>How to find a Facebook Marketplace listing date</title>
<link>https://johna.compoutpost.com/blog/1893/how-to-find-a-facebook-marketplace-listing-date/</link>
<description>Every now and then I come across a Facebook Marketplace listing where the listing date is not shown on both the desktop website and Android app. There is no &quot;Listed 8 hours ago&quot; type message on the listing page like there usual is, or in search results.&lt;br&gt;&lt;br&gt;The only way I found to find the listing date is to login to the mobile version of the Facebook website either by opening it on a phone or simulating access as a mobile device on a desktop browser.&lt;br&gt;&lt;br&gt;To do this on a desktop, open the Facebook listing page in your browser. These instructions work for Chrome or Edge. Here's the original page, with just a &quot;Listed in...&quot; location message.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;/blog/uploads/img1893_fb1.jpg&quot;&gt;&lt;img alt=&quot;Step 1&quot; src=&quot;/blog/thumb/img1893_fb1_lg.jpg&quot; class=&quot;img-fluid&quot; /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;Press F12 to open developer tools and then press the button to toggle the device toolbar on.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;/blog/uploads/img1893_fb2.jpg&quot;&gt;&lt;img alt=&quot;Step 2&quot; src=&quot;/blog/thumb/img1893_fb2_lg.jpg&quot; class=&quot;img-fluid&quot; /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;You can then choose a device such as &quot;iPhone 12 Pro&quot; from the list in the toolbar.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;/blog/uploads/img1893_fb3.jpg&quot;&gt;&lt;img alt=&quot;Step 3&quot; src=&quot;/blog/thumb/img1893_fb3_lg.jpg&quot; class=&quot;img-fluid&quot; /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;Then reload or refresh the page. Finally you can see the approximate listing date.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;/blog/uploads/img1893_fb4.jpg&quot;&gt;&lt;img alt=&quot;Step 4&quot; src=&quot;/blog/thumb/img1893_fb4_lg.jpg&quot; class=&quot;img-fluid&quot; /&gt;&lt;/a&gt;</description>
<comments>https://johna.compoutpost.com/blog/1893/how-to-find-a-facebook-marketplace-listing-date/#comments</comments>
<pubDate>2025-10-25T12:00:00+10:00</pubDate>
<category>SEO and Social Networking</category>
<image>https://johna.compoutpost.com/blog/uploads/img1893_fb1.jpg</image>
<guid>https://johna.compoutpost.com/blog/1893</guid>
</item>
<item>
<title>How to improve your website links on Facebook using meta tags</title>
<link>https://johna.compoutpost.com/blog/695/how-to-improve-your-website-links-on-facebook-using-meta-tags/</link>
<description>Facebook has a number of Open Graph meta tags that you should consider adding to your web pages to ensure that your pages are presented in the best possible way when they are shared on Facebook.&lt;br&gt;&lt;br&gt;All tags should be added inside your web page's HEAD tag and should use the following format:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&amp;lt;meta property=&quot;og:tag&quot; content=&quot;value&quot; /&amp;gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Here's a run down of the important tags.&lt;br&gt;&lt;br&gt;&lt;b&gt;og:title&lt;/b&gt;&lt;br&gt;&lt;br&gt;This is the title that will appear when your page is shared on Facebook. Ideally it should be up to 95 characters long. You want to briefly introduce your page and encourage users to read on or click.&lt;br&gt;&lt;br&gt;&lt;b&gt;og:description&lt;/b&gt;&lt;br&gt;&lt;br&gt;This is like your meta description tag but should be written in a way that encourages people to go to your page. It doesn't have to be keyword rich like your SEO tags.&lt;br&gt;&lt;br&gt;Facebook recommend a one or two sentence description of your page.&lt;br&gt;&lt;br&gt;&lt;b&gt;og:image&lt;/b&gt;&lt;br&gt;&lt;br&gt;If you specifiy an image URL as the value for this tag, that image will be shown with your link. Otherwise Facebook may try and use what it thinks is the most relevant image from your page, which doesn't always work out so well.&lt;br&gt;&lt;br&gt;Choose an image that is relevant to your page but attracts people so hopefully they will go to your page.&lt;br&gt;&lt;br&gt;Facebook's requirement is that images must be no more than 5MB in size and at least 50px by 50px, although a minimum 200px by 200px is preferred and 1500px by 1500px is recommended. The image can have a maximum aspect ratio of 3:1. You can use a PNG, JPEG or GIF image.&lt;br&gt;&lt;br&gt;Note also that multiple og:image tags can be included to associate multiple images with your page.&lt;br&gt;&lt;br&gt;&lt;b&gt;og:url&lt;/b&gt;&lt;br&gt;&lt;br&gt;It's a good idea to specifiy your pages canonical URL here. Often pages can have multiple URLs which can dilute a page's popularity, so in this tag you should specify your full preferred URL.&lt;br&gt;&lt;br&gt;&lt;b&gt;og:type&lt;/b&gt;&lt;br&gt;&lt;br&gt;The choices are activity, sport, bar, company, cafe, hotel, restaurant, cause, sports_league, sports_team, band, government, non_profit, school, university, actor, athlete, author, director, musician, politician, public_figure, city ,country, landmark, state_province, album, book, drink, food, game, product, song, movie, tv_show, blog, website or article. See &lt;a href=&quot;https://developers.facebook.com/docs/opengraphprotocol/#types&quot; target=&quot;_blank&quot;&gt;the full list&lt;/a&gt;.&lt;br&gt;&lt;br&gt;Some types have additional tags. If a product has a UPC add a &lt;b&gt;og:upc&lt;/b&gt; tag and for books add a &lt;b&gt;og:isbn&lt;/b&gt; tag.&lt;br&gt;&lt;br&gt;&lt;b&gt;og:site_name&lt;/b&gt;&lt;br&gt;&lt;br&gt;Here you can specify your website's name. This one is not so important.&lt;br&gt;&lt;br&gt;&lt;br&gt;With these tags in place you can be sure you are getting the best value out of social networking on Facebook.&lt;br&gt;&lt;br&gt;&lt;img alt=&quot;Facebook meta tags&quot; src=&quot;/blog/uploads/img695_facebook-meta-tags.jpg&quot;&gt;</description>
<comments>https://johna.compoutpost.com/blog/695/how-to-improve-your-website-links-on-facebook-using-meta-tags/#comments</comments>
<pubDate>2013-03-26T12:00:00+10:00</pubDate>
<category>SEO and Social Networking</category>
<guid>https://johna.compoutpost.com/blog/695</guid>
</item>
<item>
<title>Login with Facebook in ASP.NET C#  - Retrieve user details</title>
<link>https://johna.compoutpost.com/blog/605/login-with-facebook-in-asp-net-c-retrieve-user-details/</link>
<description>I needed to add a login with Facebook button to a website and wanted a simple solution that would check whether the user successfully logged in and return their email address and name. I considered using the C# SDK but couldn't find much in the way of documentation or samples to accomplish this task.&lt;br&gt;&lt;br&gt;&lt;center&gt;&lt;em&gt;&lt;a href=&quot;http://www.computeroutpost.com.au/&quot; target=&quot;_blank&quot;&gt;The Computer Outpost&lt;/a&gt; is an Australian-based online automotive book shop specialising in car workshop manuals and books.&lt;/em&gt;&lt;/center&gt;&lt;br&gt;We first need the usual Facebook JavaScript code to load the Facebook JavaScript API, and then we need to subscribe to an event so that we can redirect to a page where we can capture the user's details.&lt;br&gt;&lt;pre&gt;&amp;lt;div id=&quot;fb-root&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br&gt;&amp;lt;script src=&quot;http://connect.facebook.net/en_US/all.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br&gt;&amp;lt;script&amp;gt;&lt;br&gt;	FB.init({ appId: '000', status: true,&lt;br&gt;		cookie: true, xfbml: true, oauth: true&lt;br&gt;	});&lt;br&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br&gt;The following code creates the Facebook log in button, and redirects them to my Facebook server side code to log in the user.&lt;br&gt;&lt;pre&gt;&amp;lt;fb:login-button scope=&quot;email&quot; onlogin=&quot;window.location.href='/FB.aspx?dest=&amp;lt;%= Server.UrlEncode(Request.Url.PathAndQuery) %&amp;gt;';&quot;&amp;gt;Login with Facebook&amp;lt;/fb:login-button&amp;gt;&lt;/pre&gt;&lt;br&gt;If the user logged in by Facebook then I want them logged out of my site of they log out if Facebook, so I put the following code in a PlaceHolder control and only show it if they did log in with Facebook. Inside this PlaceHolder is a logout button (you would need to add a server side event to handle logging out the user), and when the Facebook logout event occurs it triggers a click of your logout button.&lt;br&gt;&lt;pre&gt;&amp;lt;asp:PlaceHolder ID=&quot;plhLogout&quot; runat=&quot;server&quot; Visible=&quot;false&quot;&amp;gt;&lt;br&gt;	&amp;lt;asp:Button ID=&quot;btnLogout&quot; runat=&quot;server&quot; OnClick=&quot;btnLogout_Click&quot; Text=&quot;Logout&quot;&amp;gt;&lt;br&gt;	&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br&gt;		FB.Event.subscribe('auth.logout', function (response) {&lt;br&gt;			__doPostBack(&quot;&amp;lt;%= btnLogout.UniqueID %&amp;gt;&quot;, &quot;&quot;);&lt;br&gt;		});&lt;br&gt;	&amp;lt;/script&amp;gt;&lt;br&gt;&amp;lt;/asp:PlaceHolder&amp;gt;&lt;/pre&gt;&lt;br&gt;The Facebook App ID and App Secret need to be stored in the web.config file.&lt;br&gt;&lt;pre&gt;&amp;lt;add key=&quot;FacebookAppId&quot; value=&quot;000&quot;/&amp;gt;&lt;br&gt;&amp;lt;add key=&quot;FacebookAppSecret&quot; value=&quot;abc000&quot;/&amp;gt;&lt;/pre&gt;&lt;br&gt;The following code is FacebookLogin.cs which contains a class for storing user information (FacebookUser) and the necessary code to retrieve the user's details.&lt;br&gt;&lt;pre&gt;using System;&lt;br&gt;using System.Collections.Generic;&lt;br&gt;using System.Collections.Specialized;&lt;br&gt;using System.Configuration;&lt;br&gt;using System.IO;&lt;br&gt;using System.Net;&lt;br&gt;using System.Security.Cryptography;&lt;br&gt;using System.Text;&lt;br&gt;using System.Text.RegularExpressions;&lt;br&gt;using System.Web;&lt;br&gt;using System.Web.Script.Serialization;&lt;br&gt;&lt;br&gt;namespace MyWebsite&lt;br&gt;{&lt;br&gt;	public class FacebookLogin&lt;br&gt;	{&lt;br&gt;		protected static string _appId = null;&lt;br&gt;		protected static string AppId&lt;br&gt;		{&lt;br&gt;			get&lt;br&gt;			{&lt;br&gt;				if (_appId == null)&lt;br&gt;					_appId = ConfigurationManager.AppSettings[&quot;FacebookAppId&quot;] ?? null;&lt;br&gt;				return _appId;&lt;br&gt;			}&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		protected static string _appSecret = null;&lt;br&gt;		protected static string AppSecret&lt;br&gt;		{&lt;br&gt;			get&lt;br&gt;			{&lt;br&gt;				if (_appSecret == null)&lt;br&gt;					_appSecret = ConfigurationManager.AppSettings[&quot;FacebookAppSecret&quot;] ?? null;&lt;br&gt;				return _appSecret;&lt;br&gt;			}&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		public static FacebookUser CheckLogin()&lt;br&gt;		{&lt;br&gt;			if (HttpContext.Current.Request.Cookies[&quot;fbsr_&quot; + AppId] == null)&lt;br&gt;			{&lt;br&gt;				return null;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			string fbsr = HttpContext.Current.Request.Cookies[&quot;fbsr_&quot; + AppId].Value ?? string.Empty;&lt;br&gt;&lt;br&gt;			int separator = fbsr.IndexOf(&quot;.&quot;);&lt;br&gt;			if (separator == -1)&lt;br&gt;			{&lt;br&gt;				return null;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			string encodedSig = fbsr.Substring(0, separator);&lt;br&gt;			string payload = fbsr.Substring(separator + 1);&lt;br&gt;&lt;br&gt;			string sig = Base64Decode(encodedSig);&lt;br&gt;&lt;br&gt;			var serializer = new JavaScriptSerializer();&lt;br&gt;			Dictionary&amp;lt;string, string&amp;gt; data = serializer.Deserialize&amp;lt;Dictionary&amp;lt;string, string&amp;gt;&amp;gt;(Base64Decode(payload));&lt;br&gt;&lt;br&gt;			if (data[&quot;algorithm&quot;].ToUpper() != &quot;HMAC-SHA256&quot;)&lt;br&gt;			{&lt;br&gt;				return null;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			HMACSHA256 crypt = new HMACSHA256(Encoding.ASCII.GetBytes(AppSecret));&lt;br&gt;			crypt.ComputeHash(Encoding.UTF8.GetBytes(payload));&lt;br&gt;			string expectedSig = Encoding.UTF8.GetString(crypt.Hash);&lt;br&gt;&lt;br&gt;			if (sig != expectedSig)&lt;br&gt;			{&lt;br&gt;				return null;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			string accessTokenResponse = FileGetContents(&quot;https://graph.facebook.com/oauth/access_token?client_id=&quot; + AppId + &quot;&amp;redirect_uri=&amp;client_secret=&quot; + AppSecret + &quot;&amp;code=&quot; + data[&quot;code&quot;]);&lt;br&gt;			NameValueCollection options = HttpUtility.ParseQueryString(accessTokenResponse);&lt;br&gt;				&lt;br&gt;			string userResponse = FileGetContents(&quot;https://graph.facebook.com/me?access_token=&quot; + options[&quot;access_token&quot;]);&lt;br&gt;&lt;br&gt;			userResponse = Regex.Replace(userResponse, @&quot;u([dA-Fa-f]{4})&quot;, v =&amp;gt; ((char)Convert.ToInt32(v.Groups[1].Value, 16)).ToString());&lt;br&gt;&lt;br&gt;			FacebookUser user = new FacebookUser();&lt;br&gt;&lt;br&gt;			Regex getValues = new Regex(&quot;(?&amp;lt;=&quot;email&quot;:&quot;)(.+?)(?=&quot;)&quot;);&lt;br&gt;			Match infoMatch = getValues.Match(userResponse);&lt;br&gt;			user.Email = infoMatch.Value;&lt;br&gt;&lt;br&gt;			getValues = new Regex(&quot;(?&amp;lt;=&quot;first_name&quot;:&quot;)(.+?)(?=&quot;)&quot;);&lt;br&gt;			infoMatch = getValues.Match(userResponse);&lt;br&gt;			user.FirstName = infoMatch.Value;&lt;br&gt;&lt;br&gt;			getValues = new Regex(&quot;(?&amp;lt;=&quot;last_name&quot;:&quot;)(.+?)(?=&quot;)&quot;);&lt;br&gt;			infoMatch = getValues.Match(userResponse);&lt;br&gt;			user.LastName = infoMatch.Value;&lt;br&gt;&lt;br&gt;			return user;&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		protected static string FileGetContents(string url)&lt;br&gt;		{&lt;br&gt;			string result;&lt;br&gt;			WebResponse response;&lt;br&gt;			WebRequest request = HttpWebRequest.Create(url);&lt;br&gt;			response = request.GetResponse();&lt;br&gt;			using (StreamReader sr = new StreamReader(response.GetResponseStream()))&lt;br&gt;			{&lt;br&gt;				result = sr.ReadToEnd();&lt;br&gt;				sr.Close();&lt;br&gt;			}&lt;br&gt;			return result;&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		protected static string Base64Decode(string input)&lt;br&gt;		{&lt;br&gt;			UTF8Encoding encoding = new UTF8Encoding();&lt;br&gt;			string encoded = input.Replace(&quot;=&quot;, string.Empty).Replace('-', '+').Replace('_', '/');&lt;br&gt;			var decoded = Convert.FromBase64String(encoded.PadRight(encoded.Length + (4 - encoded.Length % 4) % 4, '='));&lt;br&gt;			var result = encoding.GetString(decoded);&lt;br&gt;			return result;&lt;br&gt;		}&lt;br&gt;	}&lt;br&gt;&lt;br&gt;	public class FacebookUser&lt;br&gt;	{&lt;br&gt;		public string UID { get; set; }&lt;br&gt;		public string Email { get; set; }&lt;br&gt;		public string FirstName { get; set; }&lt;br&gt;		public string LastName { get; set; }&lt;br&gt;	}&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;Then on the page we redirect to upon login (in this case FB.aspx) we can check that the user logged in and retrieve their email address and first name.&lt;br&gt;&lt;pre&gt;FacebookUser user = FacebookLogin.CheckLogin();&lt;br&gt;if (user != null)&lt;br&gt;{&lt;br&gt;	Response.Write(&quot;&amp;lt;p&amp;gt;&quot; + user.Email);&lt;br&gt;	Response.Write(&quot;&amp;lt;p&amp;gt;&quot; + user.FirstName);&lt;br&gt;	Response.Write(&quot;&amp;lt;p&amp;gt;&quot; + user.LastName);&lt;br&gt;}&lt;/pre&gt;</description>
<comments>https://johna.compoutpost.com/blog/605/login-with-facebook-in-asp-net-c-retrieve-user-details/#comments</comments>
<pubDate>2012-03-23T12:00:00+10:00</pubDate>
<category>ASP.NET Web Forms</category>
<category>SEO and Social Networking</category>
<guid>https://johna.compoutpost.com/blog/605</guid>
</item>
</channel>
</rss>
