Last post Dec 18, 2015 03:41 AM by Premy
Dec 18, 2015 03:41 AM|Premy|LINK
I built a site for a school with a page "Events" where users can see a slideshow of images. The client wants to be able to copy the link of the first image in the slideshow, post it on the school's facebook page, so that when a visitor clicks the image on
FB, he will get back to the "Events" page on the site where he can then view the slideshow. But of course, with this setup the visitor gets redirected to the school's site and sees just the picture (let's say the pic url pasted in FB was ourschool.com/eventimages/event1.jpg,
then the visitor on fb will be served exactly that link address and not ourschool.com/events.aspx).
So I tried to solve this by adding a web.config in the eventimages folder with the following:
<add name="picHandler" verb="*" path="EventImages/*.jpg" type="SimpleHandler" />
Then in the App_Code folder I added a class with the following handler:
Public Class SimpleHandler : Implements IHttpHandler
Public Sub ProcessRequest(Context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim orig As String = Context.Request.UrlReferrer.Host
If orig = "www.facebook.com" Then
Now when I click on a link on FB that points to the eventimages folder, I'm being properly redirected to events.aspx, but the images just won't show up, even when visiting events.aspx directly, i.e. not through FB. The problem persists when I comment out
the httphandler, and the only way to get the images showing up again is deleting the web.config file.
Any ideas please???