Thursday, October 10, 2013

Control file download using a HttpHandler - without exposing the files location

This will show you how to make a HttpHandler which can retrieve files without exposing the files location.
You can add additional logic such as download count or access restriction.

First things first, you'll need to setup your HttpHandler, I've called mine GetFile.cs:
namespace Sample.HttpHandlers
    public class GetFile : IHttpHandler
        public bool IsReusable
            get { return false; }

        public void ProcessRequest(HttpContext context)
            // The logic goes here
Remember to add the handler in your web.config, additional information can be found at microsoft support.
<add name="GetFile" verb="*" path="GetFile.axd" type="Sample.HttpHandlers.GetFile"/>

Friday, March 8, 2013

Override class library web service reference in web.config

The import thing is to remember to add the configSection to your web.config.

I might write it up later but for now here is a link, thanks to James McCormack for the solution:

Tuesday, February 12, 2013

Visual Studio Check-in Option Changed to “Check In Now”

This really helped me, and I still don't know why it chose to check that option all of a sudden.
"Tools -> Options -> Source Control -> Environent -> Uncheck "Don't show check in dialog box when checking items in"
source: Stackoverflow: Visual Studio Check-in Option Changed to “Check In Now”

Saturday, January 26, 2013

Now the proud owner of a Synology DiskStation DS212j

I just bought my first NAS and I must say it have impressed me, even if it's a budget version it does a very good job at everything I've thrown at it so far.

Google Drive is my primary backup place, but I needed another location for the "less important files", I used to use my HTPC but I got tired of it because it had to be turned on all the time, and it wasn't the optimal solution.

So what am I using this DS212j for?

  • Store files on my WD Red 2TB (obviously)
  • Making the files accessible from LAN using samba share and sftp to access the files from WAN
  • Storing my XBMC library across my network using the built in MySQL database
  • Surveillance station is linked to my IP Cam
  • Planning to look at how the backup software works

Thursday, January 17, 2013

jQuery maintain position on postback / refresh

My friend asked me for a solution where he would be able to maintain scroll position on postback/refresh without altering the URL itself. So I desited to make my first jQuery Plugin, it's very simple but it works: maintainPosition