Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.
  • SignalR

    Sharing Photos using SignalR

Search This Blog

Monday, 4 November 2013

Subdomain with ASP.NET MVC using Attribute Routing

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...

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...

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...

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...

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...

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...

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...

Wednesday, 17 July 2013

Enabling HTTP Handler to render in IE Compatibility mode

HTTP handlers are generally used for download a file, show an image, or even to show a report (ie.. generated as html at runtime and stream it through) Now consider your html report was generated and now all you need to do is show through your website using ASP.NET http handler. Opening the report html just show all the formatting properly but via http handler some of styles were not correctly applied. To resolve this you have...

Wednesday, 10 July 2013

Using Selenium WebDriver to simulate button click for ASP.NET Webforms application that uses DevExpress Controls

First lets create a simple ASP.NET Web application that uses DevExpress controls. I have created a test.aspx page that has got 2 buttons Code behind (test.aspx.cs) protected void TestMe_Click(object sender, EventArgs e) { Response.Redirect("success.aspx"); } protected void TestMe2_Click(object...

Thursday, 13 June 2013

Live tiles with Bootmetro and Metro JS

Bootmetro is a simple web ui framework which I have used on my website TechCipher. There are various samples inside Bootmetro for implementing various type of tiles but not for live tiles. This article will give you insight of how live tiles can be implemented with Bootmetro and Metro JS. 1. Define tile Latest Updates ...

Thursday, 6 June 2013

Input string was not in a correct format exception thrown by DevExpress controls

Recently I have stumped upon an exception thrown by DevExpress controls and this is trace : 2013-06-04 15:29:37.9138 6: csdrtg55bpufcimx3dm2o145 Error:global_asax threw EXCEPTION: Input string was not in a correct format. 2013-06-04 15:29:37.9138 6: csdrtg55bpufcimx3dm2o145 SOURCE:mscorlib 2013-06-04 15:29:37.9138 6: csdrtg55bpufcimx3dm2o145...

Friday, 26 April 2013

Set deadlock priority with NHibernate

Sometimes you would want to explicitly set dead lock priority as part of a transaction which is not possible if you are using NHibernate as of now. In such cases you can define a custom Interceptor which does the trick. Here is a small snippet of code that can help you achieve that: public class DeadLockPriorityInterceptor : EmptyInterceptor { private ISession session; private string priority; public DeadLockPriorityInterceptor(string...

Wednesday, 24 April 2013

CompositeId() throws exception - Could not compile the mapping document: (XmlDocument)

After defining a map for composite key CompositeId() .KeyProperty(x => x.title) .KeyProperty(x => x.label); The following exception is raised when trying to create a composite key CreateSessionFactory() - Inner exception: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. .. CreateSessionFactory()...

Saturday, 13 April 2013

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

Have encountered with an sql error after running following sql: INSERT INTO [Member](FirstName, LastName, CreationDate, LastActivityDate) VALUES ('Saif', 'Ikram' , '13/04/2013 22:15:44', '01/01/1753 00:00:00') go "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value". Actually there is nothing wrong with sql. Now run following sql to see if this works set language british go INSERT...

Thursday, 4 April 2013

Consuming return value from stored procedure using NHibernate without mapping

After haggling around I have found a solution that works. First I have created a stored procedure as follows: CREATE PROCEDURE GETTOTALINCOME AS DECLARE @TOTALINCOMECOUNT MONEY; BEGIN SELECT @TOTALINCOMECOUNT = SUM(INVAMOUNT) FROM INVOICE RETURN @TOTALINCOMECOUNT; END; This is a simple stored procedure that just returns a value. Now lets look at NHibernate code block that can execute the stored procedure and...

Monday, 25 March 2013

First Release of TechCipher 0.0.13.2303 Beta

First version of TechCipher 0.0.13.2303b released. TechCipher is for Developers, Technical or Solution Architects. TechCipher helps anyone to explore various technologies available in the market to date. This first public beta release is readonly, you will be able to browse and explore various options. TechCipher on first glance will show 2 sections - Type of Applications (An application that has been or can be developed falls...

Sunday, 6 January 2013

Custom splash screen for windows store app

Visual Studio 2012 provides various templates for developing windows store app (WinRT apps) such as Blank App, Grid App & Split App. All of these templates allows displaying a splash screen which is nothing but a static image. Sometimes that will not be the ideal solution so why not design a custom splash screen which shows some progress....
Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers