I want to try and add some override code that will perform a specific action if the user making the request is using a particular user agent. I have the two following methods that are overridden from the base ActionFilterAttribute  class. public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) public override void OnActionExecuting(HttpActionContext actionContext) I have seen other…
Is there a way to check if an Expando object contains a property before interacting with it. For example, If i were to say var test = Expando.Something and Something didn't exist, it will throw an exception. How do i check to see if "Something" exists in the expando object before I query it?
XML Serialization in C# works fairly well and is relatively easy, but XML itself makes life hard at times. JSON is always the best route to go, but when you have no option, you must deal with some badly formatted XML objects that do not map very well to the object hierarchy you have for…
Quite often when dealing with an API or some other external service, you will find that you get Unix timestamps returned to you or alternatively have to provide a timestamp in Unix form when sending a request back. Since you are going to be running your .NET code on a windows machine, you don't have…
  I recently hit an issue where i needed to change the name of an XML node. It ended up being a lot more complicated than I had expected it to be. node.Name is a read only field, so you can't take the simple route and rename it this way. Since you cannot rename the…
This tutorial will show you how to programmatically create a subsite in Sharepoint. This can be done a few different ways and if you have server access you may prefer to do this on the server side, but you can just as easily create one using the Client-Side Object Model. You can do this using a standard…
This can be done in the RouteConfig.cs. You can set the default route that will be used to display the home page. You can find this file in Project->App_Start->RouteConfig.cs. The config inside this file will let you set default home page for ASP.NET razor MVC websites. The contents of the default file should look something…
When you want to access a session from an ashx file you will find that using context.Session["value"] , will not allow you to access the session variables from the previous file where the session was available from. This is expected behavior and based on some guides Ihave seen, is often over complicated. Rather than building a work around…
When using Sql Server to insert records into a DB its a common requirement to be able to pull back the auto incremented Id that was generated for this row. Most solutions for this i have seen involve making a second query to the database in and along the lines of  "SELECT @@IDENTITY", but this method…
I found it quite odd to discover that there was no built in method to count the total amount of lines for a project in Visual Studio 2013. I did some searching and found that pretty much every guide was saying download this application or install this plugin in order to get the code metrics.…