It’s been two years since my first attempt to integrate RequireJS with ASP.NET MVC. Being my first open-source project it was fun and challenging. Version 2.0, developed and maintained by VeriTech, comes with new features and major improvements especially to the bundling component.
- new JSON config format compatible with require.js configuration object, the XML format from v1.x is deprecated
RequireControlleris no longer need and has been removed
- breaking changes in RenderRequireJsSetup HTML helper, it takes a single argument of type
- auto bundling capabilities
- compressor and config parser refactoring
- project website with updated tutorials requirejsnet.veritech.io
- up-to-date documentation wiki
- various bug fixes
Upgrade from v1.x
A new journey starts for me today as CEO and Co-Founder at VeriTech.io #startup
Redis is gaining traction in the .NET world, checkout the new Azure Redis Cache service
The code snippet horror
Till now embedding code snippets in a WordPress blog post was a painful process for me. I’ve tried several plugins but in the end all have a major downside when it comes to editing, I just couldn’t edit a single line of code because the original code block was transformed into HTML.
For a while I was using Live Writer, it was way better than fighting with TinyMCE, but code editing had the same downside, every time I wanted to make an edit, I had to paste the original snippet in Visual Studio, made the edit there and then override it in Live Writer. Another inconvenient for me with Live Writer was the preview feature that didn’t quite work with my WordPress theme. After I realize that posting from Live Writer makes it impossible to edit the post in WordPress editor because the code blocks loose padding, I’ve given up the Live Writer.
As a GitHub user I grow found of Markdown, it felt natural to document my projects with it but embedding gists in blog posts felt wrong. Making a gist for every snippet was messy, not to mention that it doesn’t work with RSS readers since the code blocks are not stored in the blog post content.
Calling ASP.NET Web API endpoints at regular intervals can be easily done using Windows Task Scheduler and PowerShell’s Invoke-RestMethod. The following script makes a GET call for each supplied endpoint, if a call fails then the endpoint’s URL and the error details are sent to Windows Application Event Log.
With MvcThrottle you can protect your site from aggressive crawlers, scraping tools or unwanted traffic spikes originated from the same location by limiting the rate of requests that a client from the same IP can make to your site or to specific routes. MvcThrottle is compatible with ASP.NET MVC 5.1 and can be installed via NuGet, the package is available at nuget.org/packages/MvcThrottle.
You can set multiple limits for different scenarios like allowing an IP to make a maximum number of calls per second, per minute, per hour or per day. You can define these limits to address all requests made to your website or you can scope the limits to each Controller, Action or URL, with or without query string params.
- – added per Week rate limit that can be used with Redis, Azure caching or any other caching service that can hold data more then 24h
- – added TracingThrottleLogger to publish throttling messages to the native web api ITraceWritter if one is supplied
- – allow override of throttle key computation ComputeThrottleKey
- – allow override of HTTP Status code when requests are rate limited
- – short-circut large control statements
- – move whitelist checking to separate method
- – use member ThrottlePolicy instead of passing it around
- – RequestIndentity renamed to RequestIdentity