Archives for January 2013

What is ASP.NET

ASP.NET is a programming language by Microsoft to help developers develop dynamic web pages faster and easier than conventional methods. If you don’t know what ASP.NET is and is planning to use it in your server, you can do so easily by following this guide. This article covers the basics of ASP.NET starting from the necessary tools and software required to run ASP.NET like installing IIS web server to deploy your first application and setting it up and configurations you can do to make you application run smoothly as expected. I highly recommend that you read this article specially if you want to learn more about this programming language. It has in-depth coverage of the language and a quick hands-on which covers everything you need to know.

Read the rest of the tutorial in

How to Build a Responsive UI using Twitter Bootstrap and MVC

If you say you are building a responsive design, it means that it can adapt itself to any screen size. This is now an essential aspect in web design because nowadays, its not just computer screens that are using the web, we have also mobile phones, tablets, and other small-screened devices you have to think about when designing a UI for the web.

Building a responsive UI is not as difficult as you know it is. This article will explain how to build a responsive UI design using an established boiler plate UI design that is Bootstrap, by Twitter. This will also explain how to replace the default ASP.NET styling using Twitter bootstrap and create a project template which can become a starter MVC projects using Bootstrap.

Read the tutorial here:

How Hackers Target and Attack Your Site

There are so many reasons web pages are hacked. However, this article will explain a quick overview on what are the common techniques used by hackers to hack into your site.

For example, using a simple command can target not just one but many sites that are hosted under the same server. Hackers will need additional information about your website like:

DNS records
Web Server specifications
Your name, address, phone, etc.
Scripts used in your site,
Server operating system
Your Server open ports.

Here is an infographic about WordPress security that is roughly the same even on non-wordpress sites.
Read the rest of the story here:

Testing Anonymous Return Types Using ASP.NET MVC Action Method

You might encounter a situation where you want to test the returned value of an ASP.NET MVC controller like this action method:

public JsonResult GetById(long id)
var person = personRepository.GetById(id);
return Json(person, JsonRequestBehavior.AllowGet);

You can test an action method by invoking the controller’s action method to get the returned result. The actual data of interest will then get wrapped according to its data property.

You can also test for Anonymous types using dynamic types. Anonymous types are internal, so you need to add InternalsVisibleTo attribute on the tested assembly, so be cautious when using Anonymous types.

These tests can be written in a very simple form. Read this blog from to find out.

How to Create MVC Outbound URL

When we talk about web applications, users would be our first priority. Our applications should be easy to navigate from page to page, so, as a developer, our goal is to give a reasonable name for every page. However, creating a user-friendly page sometimes becomes in conflict with MVC principles. According to the MVC principle, it should first come to the controller but by using the suggested method earlier, it bypasses your controller logic and your MVC architecture will be completely useless.

Hyperlinks should have actions in the anchor tags and not page names. To do that, we need to perform the following.

1. Create views with a simple navigation between pages.
2. Create a controller for the view. This snippet below will help you do that:
public class SiteController : Controller

// GET: /Site/

public ActionResult GotoHome()
return View("Home");

public ActionResult AboutUs()
return View("About");

public ActionResult SeeProduct()
return View("Product");

3. Provide actions in the link. Rather than the views, we need to specify the action in the anchor tag.

4. Enjoy your navigation. Test it to see if it works.

Read the rest of the tutorial here:

How to Use ASP.NET WebAPI to Retrieve Images from a Database Server

If you didn’t know how to use ASP.NET to retrieve images, this article will explain the method on how it is done. The process is simple, the action method exposed using WebAP can be consumed directly in JQuery using AJAX and since JSOn response is returned by default, all you need to do now is to send the image in the response object.

The whole idea is to take advantage of HttpResponseMessage  in the binary data of the database server. The binary data from the server is converted into images then is passed using the HttpResponseMessage object.

The author has worked with different scenarios and it is all covered in the blog post.

Read the rest of the tutorial in

Passing Between Controllers and Views using ASP.NET MVC

When passing data between controllers and views, the controller will get the first hit then loads it to the model. Most of the time, this is not what we want. We’d like to pass the model to the view if we want to display it, but how can we do that?

Our first choice would be to use session variables, view state or use ASP.NET session management object. The problem with these methods, is that they are not as efficient as we want it to be, and the scope. This article will explain how to pass controllers and views using ASP.NET MVC.

Read this blog to find out how.

Create MVC Views Faster Using HTML Helper Class

Do you know that you can create simple MVC views using HTML helper class? This article will explain how it’s done. If you have created MVC views before, you know that it is tedious and very time consuming. Using this method, we can be more productive and produce results faster.

First create a simple class.
Then create the input HTML form using helper classes.
Create form tag for HTML by using the following code:

<% using (Html.BeginForm("DisplayCustomer","Customer",FormMethod.Post))  {%>
-- HTML input fields will go here 
<%} %>

It will generate this HTML:

….. …..



Then create a strong typed view using your created class.
Create a controller class and enjoy your newly created MVC views using HTML helper.

A detailed instruction is in this blog.

Introduction to HTTP Response Headers for Security

HTTP or Hyper Text Transfer Protocol is a stateless protocol – it does not record what happened in the past. Its original purpose is to transfer files and see interconnected information. Now that the World Wide Web has evolved into a bigger, and more complex system, HTTP is now the biggest open market place in the history of the world.

Most web application nowadays are front-end databases that contain user-specific data. It also uses sessions to maintain their state. A session is created when a user enters a username and password. This type of authentication is the true form of HTTP. When it is successful, users can now browse the application seamlessly.

You can use headers to prevent XSS, strict-transport-security, and protect against content sniffing attacks.

Read this tutorial to find out more.

How to Customize ASP.NET Web API Routing For Methods in APIController Class

If you are familiar with WebAPI Controller and MVC4, then you’ll know what API controller class. In a practical scenario, the developer may implement the WebAPI if he or she wants to write his or her own method and want to map it with HTTP Requests like GET|POST. The example below is what APIController class can do:

public class ValuesController : ApiController
// GET api/values
public IEnumerable<string> Get()
return new string[] { “value1”, “value2” };

// GET api/values/5
public string Get(int id)
return “value”;

// POST api/values
public void Post([FromBody]string value)

// PUT api/values/5
public void Put(int id, [FromBody]string value)

// DELETE api/values/5
public void Delete(int id)


Read the rest of the tutorial here: