ASP.NET MVC Routing allows defining various mappings and recently I have looked at an interesting framework known as Attribute Routing.
Using Attribute Routing setting up a subdomain for your website that uses ASP.NET MVC is very simple. Now consider you have a website www.csharptechies.com and you would want to define subdomains such as blog.csharptechies.com, projects.csharptechies.com, labels.csharptechies.com etc.... Each...
CSharp Techies
public string aboutme {
var known = { { "C#" , "Javascript" }, { "ASP.NET", "MVC" } };
return known.ToJson();
}
Monday, 4 November 2013
Friday, 25 October 2013
Restricting access to a webservice in ASP.NET
Restricting access to a webservice can be done via web.config but if you would want to make the decision at runtime then here is an example of how you could achieve this
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (/*Condition*/)
{
if (HttpContext.Current.Request.Url.ToString().Contains("Admin.asmx"))
{
HttpContext.Current.Response.StatusCode = 404;
}
}
}
Genius ain't...
Labels:
ASP.NET,
ASP.NET MVC
Wednesday, 16 October 2013
Mock frameworks for .NET Part 2
As we have already seen the basics of Mock framework, let's look at some of Mock frameworks that are available and understand what they do or don't support.
NMock
Software License
Apache License 2.0
Last Active
Jul-2011
Latest Version
NMock3
Supported .NET Version
.NET 4.0
Build Server Integration
No
Code Coverate Integration
No
Mock Interfaces
Yes
Mock Everything
No
Mock Legacy Code
No
Auto Recursive...
Labels:
Mock frameworks
Monday, 7 October 2013
Mock frameworks for .NET Part 1
Mock frameworks are used for unit testing your code and are used for Test Driven Development (TDD). A mock framework should support Arrange Act Assert (AAA) pattern. There are various mock frameworks available and choosing the right one is not easy. Before looking at various frameworks available let's understand some basics of what a framework should have to be known as a Mock framework.
Mock Interfaces & abstract classes
Interfaces...
Labels:
Mock frameworks
Wednesday, 25 September 2013
Using ASP.NET Web API for streaming pictures
ASP.NET Web API 2.0 provides various new features and one of which is Attribute Routing. Attribute routing allows custom configuration for routing by assigning attribute to the web method.
Get latest version of ASP.NET Web API 2.0 via Nuget package
Install-Package Microsoft.AspNet.WebApi.WebHost
Update WebApiConfig to include config.MapHttpAttributeRoutes()
public static class WebApiConfig
{
public static void...
Labels:
RESTful API,
Web API
Saturday, 21 September 2013
Server Side MVC vs Client Side MVC
MVC (Model–view–controller) is an architecture patterns that addresses separation of concerns, test driven development, statelessness, extensibility, SEO, REST and many more. Choosing MVC pattern for developing web application is a very easy decision, but that is just the beginning. Rest of decision is deciding how to design, develop and implement the web application.Now deciding on "Server Side MVC" or "Client Side MVC" is not...
Labels:
Architecture
Sunday, 15 September 2013
Streaming millions of rows as a csv in ASP.NET MVC
Generating reports using the data from the database is something any project will generally have, but to be able to actually download all of the data as a csv is not easy. Not just thousands of rows but if database has millions of rows then challange will be to decide best approach. Consider following approaches
1. Generate the report on server and then stream the file to clients machine
2. Stream data in batches onto client...
Labels:
ASP.NET MVC
Subscribe to:
Posts (Atom)