Building C# applications using the developer command prompt

Most people use Visual Studio to run their C# programs, and don't know that they can achieve the same result by using the developer command prompt. The developer cmd prompt can be found in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts, this is for visual studio 2013. The benefits of the developer cmd prompt from the regular windows cmd prompt is that it has been pre-configured to provide you with all of the necessary ....

June 20, 2015 · 2 min · 318 words · Fahad

How to add pagination to asp.net

One of the most important feature on a website that has a search feature is that it allows for pagination (allow you to page the results). The reason you would want to make pages is to make your website run faster for the user. Rather than displaying 1000 results on one page you can change it to display 10 results on one each page with a total of 100 pages, which speeds up the site and makes navigation easier....

June 18, 2015 · 2 min · 317 words · Fahad

Adding transformations to your web.config

Transformations in asp.net is an easy way to automatically set your configurations in different environments. An example of this would be when we want our connection strings, usernames, passwords, proxies, etc. to be different in our development environment from our production environment. Since the web.config file is written in xml, we use XML Document-Transform(xdt) to make the transformations. In your VisualStudio project every web.config has a Web.Debug.config and Web.Release.config. If you have never used transformations before, you probably don't know what these files are for....

June 15, 2015 · 1 min · 194 words · Fahad

Unit testing session and application variables without mocking

If you have been unit testing your asp.net web applications that use session and application variables then you almost certainly have encountered this problem and asked yourself \"How to unit test HttpContext.Current variables?\". The general answer you would find online is use a mocking framework (Moq, Rhino Mocks, etc.). While this is the best answer, it assumes that you have written your application using interfaces to pass objects from one place to another....

June 12, 2015 · 2 min · 215 words · Fahad

How to encrypt the web.config file in ASP.NET?

It is very easy to encrypt the web.config file thanks to the .NET built-in tool aspnet_regiis.exe. We can run this tool in the command line, pass a few parameters and it will encrypt your web.config file. We will be leveraging the .NET tool aspnet_regiis.exe which can be found in the directory C:\Windows\Microsoft.NET\Framework64\v4.0.30319, the Framework64 and v4.0.30.319 may differ depending on what machine and version of .NET you are running....

June 10, 2015 · 2 min · 418 words · Fahad