htaccess to serve one file in place of another request, but you want to actually block access to. I think it has something to do with the way Firefox reports referrers. I got this to work by using an htaccess file and it is fine in IE & Safari, but for some reason Firefox doesnt cooperate.
#Prevent direct url access htaccess install#
It is normally disabled on a default install of PublishPress Permissions Pro. Here is something to try when youre using a rewrite rule in. We need to prevent direct access of files on our site from someone just entering a URL in their browser. Protected void ImageButton1_Click(object sender, ImageClickEventArgs e)įileUploadImage.SaveAs(Server.MapPath("~//Images//") + photourl + Path.GetExtension(fileUploadImage.FileName)) photourl= photourl + Path.GetExtension(fileUploadImage.FileName) īusinessLayer.InsertAlbumPhoto(Session.ToString(), photourl, ()) ĭlAlbum.DataSource = BusinessLayer.SelectAlbumDetails(Session. Make sure the File Access feature is enabled. Stack Exchange network consists of 180 Q&A communities including Stack Overflow, the largest, most trusted online community for.
GUID url: 0289a23d-da4f-4c70-a3a9-54e7171d51a3.jpg. The situation Across the entire domain, wed like the URLs to hide file extensions and remove trailing slashes, independent of the domain name itself (as in, works on any domain). If you have already enabled it, then you can skip this step. First you need to enable modrewrite (.htaccess) for your Apache server. Let us say you want to block direct access to. Like that Generate an GUID instead of the image url and store the GUID with the extension of image.ĪCtual imageurl: C:\Desktop\.\Images\myimage.jpg. If you only want to protect your images, you can put it in your images directory alone. Here are the steps to prevent direct access to images in Apache. When You are storing your images in Your Folder You no need to store it with the Url.