Running C# on AWS Lambda

One of the greatest things about AWS cloud is the AWS Lambda - event-driven service where AWS “runs your code in response to events”. It is a perfect fit for any backend jobs or scheduled tasks. Unfortunatelly AWS Lambda currently supports code in Node, Python or Java. And it runs on Amazon Linux. Thankfully, it looks like Microsoft is making .net for a cross platform world. Moreover, it looks like it would be possible to natively compile dotnet applications.

Deploying Clojure/Java based web app (via Jetty) on Windows and IIS. Step by step guide.

Few words to start with… I got into clojure programming language some time ago. It took me some time to get into lisp, functional programming and repl-based developement as that was completely opposite to what i have been doing with c# over last couple of years. I find time i have spend with clojure to be very rewarding. More on this some other time. I have recently completed small clojure based app and i needed to host it somewhere.

System.Linq.Dynamic and Spatial Searches

On my current project i am doing a LOT of dynamic searches. Lot’s of them go through System.Linq.Dynamic library - it is really just one .cs file. As library has lost somewhere on internet, the only place i have managed to find it is on one of github’s repository : I had to run some spatial searches over exposed DbGeography type - those are directly on database - via Entity Framework

This blog is powered by NancyFX!

This blog is powered by NancyFX MongoDB - source code can be found on github repo. I have to add that it was a pleasure to work with both although i remain sceptical if i would use mongodb in future. It’s lack of transactions and no async c# api really scares me. But anyway, If you are interested how both Nancyfx and MongoDB can work under .net check this one out.

Redirect to new domain after rebranding with IIS Url Rewrite Module

Client has a bunch of domains and and websites. Because They have decided to change company’s name recently I was asked to proceed with chanage of domain names as well. After few weeks of constantly informing visitors about planned changed We decided that it is a good time to abandon old domains and redirect visitors to new ones. In order to “be okay” with google (their page ranks, indexed pages and so on) we make those redirects permanent (301 Moved Permanently as a response status code).

Javascript Encode on server side - Medium Trust Environment

It happens from time to time I have to get rid of those funky apostrophe in my server/javascript code. To do such kind of things I was using Microsoft Anti-Cross Site Scripting Library. By simply calling: public static string JavaSriptEncode(this string text) { return Microsoft.Security.Application.AntiXss.JavaScriptEncode(text, false); } Unfortunately, It doesn’t work in Medium trust environment - btw, why the hell i get stingy clients. After some time digging all over internet and trying to write it by myself I accidentally found a thing that I never believed to be there.

Deploying BlackBerry OTA App (.jad, .cod files) or Android(.apk) on IIS

Hope some other people will find this post helpful. We had an issue today at work with providing BlackBerry application over the web site that was hosted on IIS 7.5. Although Screen shots that You ‘ll find below were made for this specific server procedure might look pretty much the same when it comes to older versions of IIS. By default (for IIS) .jad and .cod files are not delivered over IIS.

Handler Elmah Has a Bad Module Managedpipelinehandler in Its Module List

Elmah - awesome library for asp.net that enable to log exceptions (as well as those that end up with Yellow screen of death). It comes with a great module and a handler used to view error logs. It really helps a lot. I used that in literally every web project I have made. Yesterday, I was installing new project on fresh Windows Server 2008 R2. I ended up with an error: Handler “Elmah” has a bad module “ManagedPipelineHandler” in its module list.

Validate max file size during upload in asp.net mvc

Just a quick sketch. Validation is done as an Attribute (DataAnotations way). public class FileAttribute : ValidationAttribute { public int MaxContentLength = int.MaxValue; public string[] AllowedFileExtensions; public string[] AllowedContentTypes; public override bool IsValid(object value) { var file = value as HttpPostedFileBase; //this should be handled by [Required] if (file == null) return true; if (file.ContentLength > MaxContentLength) { ErrorMessage = "File is too large, maximum allowed is: {0} KB".FormatWith(MaxContentLength / 1024); return false; } if (AllowedFileExtensions !

Noscript Information With a Link to Google Search

Some web apps just do not work without JavaScript. Just doesn’t. Stop. We are usually asked to provide users with nice looking information that this site is best viewable with JavaScript turned on. Plus there is a need to explain them how to turn JS in their browsers. Smart and yet incredibly simple would be to direct them to google search result for a phrase like ‘How do I enable JavaScript in my browser?

Page 1 of 4