Neo4j 3.0 with a .Net driver: Neo4jClient

27 Apr 2016 .Net, C#, Databases, Graph Databases, MVC, Neo4j, NoSql No Comments

I started dabbling in Neo4j, a NoSQL graph database, around 2 years ago. I have not used it much in the .Net world, and with the recent release of Neo4j 3.0, with its built in .Net driver, I decided to have a

Continue reading →

Progromatically get SessionId Cookie name used in an asp.net application

09 Sep 2013 .Net, C#, MVC No Comments

The default name for the SessionId cookie in an Asp.Net application is ASP.NET_SessionId, but this can be changed in the web.config, e.g. I wanted to get the name of the SessionId cookie for the web app that was implementing my class library. I knew the dll would be implemented by many

Continue reading →

Get the executing assembly of a web app referencing a class library

05 Sep 2013 .Net, C#, MVC No Comments

I needed to check that any web app that was referencing my class library was giving me a valid controller and action name in some settings in its web.config, so that when I used them in a redirection there would be no errors because they did not exist. When I used to

Continue reading →

Passing in variables to custom Action Filters

20 Aug 2013 .Net, C#, Filters, MVC No Comments

Sometimes it is useful to have a reusable custom action filter, for example for checking user authorisation to access part of the application. I would prefer not to have a separate filter for each type of user, e.g. MustBeAdminAttribute, MustBeManagerAttribute, etc. There are several ways to pass variables to a

Continue reading →

Storing a byte array in a Cookie (nom!) C# MVC

15 Aug 2013 .Net, C#, MVC No Comments

It seems that cookies can eat store just about any kind of data, but keeping to a limit of 20 cookies per domain and 4096 bytes per cookie is the safe way to do it (source). I needed to store a byte

Continue reading →

Retrieving parameters from the query string in the URL in .Net

23 Jul 2013 .Net, C#, Filters, MVC No Comments

Here is a nice easy way to get the individual parameter values from the URL, returning either a NameValueCollection (System.Collections.Specialized.NameValueCollection HttpRequestBase.QueryString) of all parameters in the query string, or a string value of a particular named parameter.

var parameters = HttpContext.Request.QueryString;
var parameters = HttpContext.Current.Request.QueryString;
public class MyAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        var

Continue reading →

Downgrading an MVC4 project from .Net 4.5 to .Net 4.0

25 Jun 2013 .Net, Visual Studio No Comments

I recently created a new project in Visual Studio 2012 and didn't really think much about the .Net version (mistake!). It turns out that the server it is destined for is still MS Server 2003, which will not run .Net 4.5. Oh dear. So I Googled downgrading, and the process of

Continue reading →