Data Entry Form using Simple HTML Helper In MVC

HTML Helper in MVC

In this article we will learn how to code for entering data form using simple HTML Helpers.

  • Create New ASP.NET MVC4 Web Application.
  • Select Razor As View Engine.
  • Right click on Model ->Add new Class ->Customer Class.HELPersModel
  • Right click on controller and -> Add new item-> CustomerController


Continue reading “Data Entry Form using Simple HTML Helper In MVC”

Render Pdf bytes array within browser in MVC

Render Pdf within browser

There are different ways to render Pdf in a browser. In this I’m explaining to render Pdf by fileContent/byte array. In a below example I’m using Index Action which returns the FileContentResult.

public ActionResult Index()
Response.AddHeader(“Content-Disposition”,“inline; filename=sample.pdf”);
Response.AddHeader(“Content-Length”, byteArray.Length.ToString());
FileContentResult result = new FileContentResult(byteArray, “application/pdf”);
return result;

That’s it from controller side. Now you have to call you Action to get it rendered on your HTML. You can use different HTML5 tags like :

<iframe src = @Url.Action(“Index”, “Home”)#zoom=150′ width = “100%” height=”525″ id=”iFramePdf” #zoom=”200″ frameBorder=”1″></iframe>

<embed src=’@Url.Action(“Index”, “Home”)#zoom=150′ width = “100%” height=”525″ id=”iFramePdf” #zoom=”200″ frameBorder=”1″ type=”application/pdf”/>

<object data=’@Url.Action(“Index”, “Home”)#zoom=150′ width = “100%” height=”525″ id=”iFramePdf” #zoom=”200″ frameBorder=”1″ type=”application/pdf”>

Hope this article will help you.

Implement Jquery Auto Complete

Jquery Auto Complete

In this article we will show you how to use auto complete of jQuery. Auto complete widget provides suggestions while you type into the field. Here we are going to show you an example that how to implement auto complete and how we can customize it as per our requirement.

In the below example, we have 3 different objects in an array:
var data = [{
label: "Code",
value: ""
label: "Hotfix",
value: ""
label: "Code Hotfix",
value: ""}
$(function () {
source: function (request, response) {
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term), "i");
response($.grep(data, function (item) {
return matcher.test(item.label);
select: function (event, ui) {
window.location.href = ui.item.value;


Continue reading “Implement Jquery Auto Complete”

MVC Simple Model In ASP.NET

In our previous article we have learnt basics of MVC , now in this article we will learn how to make simple model In MVC.

  • Create New ASP.NET MVC 4 Web Application .
  • Select Internet Website as template.
  • Select ASP.NET as  View Engine
  • Right Click on the model -> Add New Item ->Class -> Movies.cs

Continue reading “MVC Simple Model In ASP.NET”

Crack Windows passwords using Ophcrack


Ophcrack is a special kind of Linux distro that focuses primarily on password cracking, Ophcrack is basically a free open source program that requires a Linux based environment to run. Ophcrack can be used to crack passwords for Windows XP, Vista and Windows 7.

How does Ophcrack Work?

To understand how ophcrack cracks password we must first learn about how Windows stores password.

Any computer system that requires password authentication must contain a database of passwords, either hashed or in plaintext.

Windows uses a thing called MD5 Hashes, so what it basically does is when you type a password and create it, it creates a cryptographic hash.

Now hashes don’t work both ways, what that means is you can create a hash from a password, but you can take a hash and change it back to text because you can’t easily decrypt them.


Continue reading “Crack Windows passwords using Ophcrack”

How to create tunnel to localhost using Ngrok

Ngrok – Secure Tunnel to localhost

Want to host your localhost server to the Internet ? Yes Ngrok is what you are looking for. With Ngrok you can create a secure tunnel to your localhost website.  Ngrok is the lightweight tool which creates a secure tunnel on your local machine along with a public URL so that it can be accessible over web. Ngrok will give you following features :

  • Demo without deploying
  • Simplify mobile device testing
  • Build webhook integrations with ease
  • lightweight alternative to VPN
  • Run personal cloud services from your own private networkNgrok a secure tunnel to localhost

Continue reading “How to create tunnel to localhost using Ngrok”

Avoid multiple call to AuthorizeCore in MVC

AuthorizeCore in MVC

In MVC AuthorizeAttribute Class is another cool feature that makes it easy to add authentication at the Controller level. In AuthorizeAttribute class we have AuthorizeCore function, it specifies that access to a controller or action method is restricted to users who meet the authorization requirement. We can override AuthorizeCore  function as per our authorization logic.

When you place the [Authorize] attribute on a Controller’s action method, a couple of calls get made to the AuthorizeAttribute class at the beginning of each request to your controller to authenticate users. Lately when I was working on a web application I found this multiple calls as an extra overload that even though the user is authorized, AuthorizeCore got executed.

So to avoid this multiple calls, I found one of the property in HttpContext which is  SkipAuthorizationSkipAuthorization is a boolean property, you can set this as true once the user is authorized. The below code snippet will give you the brief idea.

protected override bool AuthorizeCore(HttpContextBase httpContext)
if (httpContext.SkipAuthorization) return true; // hack to avoid multiple call to the method
if (!authorized) //if user is not authorize
   return false;
if (authorized) //if user is authorize
   httpContext.SkipAuthorization = true;
   return true;
   return false;

Git Tutorials for Beginner

Before we start with this article I will suggest you to first have a quick look to these articles.

  1. Understanding GIT and GitHub
  2. Basic commands that are used in GIT

Okay.. Want to start working with Git ? Confused ! where to start..  Alright I have a few suggestions for you that will answer you where to start working and get your hands-on on Git commands.

Git Tutorials Playlist

This Git Tutorials Playlist cover all basic concepts and understanding about Git, Git bash, and all basic git operations.

Git Tutorials for Beginner

Git – Self-paced Learning

This will familiarize you with Git commands with giving you the good Visual  guide. I simply call it as learn with fun. 😉

Git eBooks

These are the free eBooks for git which helps you know more about Git.

Hope you found this useful.. Happy Coding.. !!

How to read JSON data from External File

In this article we will understand how we can read JSON data from a external file.JSON is short for JavaScript Object Notation, and is a way to store information in an organized, easy-to-access manner .One of the easiest ways to load JSON data into our web applications is to use jQuery.getJSON().For this we have to understand the term “jQuery.getJSON()” .

So what is significance of jquery.getJSON?????….


It loads JSON data from the  server using GET HTTP request .


Continue reading “How to read JSON data from External File”

JSON with Javascript and Jquery

JSJavascript has grown  from a way to add interactivity on your page , to a language that lets you perform tasks that once belonged to servers.JSON provides for an easy way to create and store data structures within JavaScript. JSON stands for JavaScript Object Notation…it’s called that because storing data with JSON creates a JavaScript object. The JavaScript object can be easily parsed and manipulated with JavaScript.

First, we create a variable to hold our data, and then we use JSON to define our object. Our sample object above is a simple as it gets. Just an item called firstName and it’s value Sam. When using strings with JSON, you should use them with quotations as above. If you use numbers, then you don’t have to use quotations.

<script> var data = { “Firstname”: “Sam” }; alert(data.Firstname); </script>

Let’s put data inside an HTML element.

var data = {
"Firstname": "Sam",
"Lastname": "Legend",
"Age": "34"

 document.getElementById("placeholder").innerHTML = data.Firstname + " " + data.Lastname + " " + data.Age;
  • Every object in json is stored with curly braces {}, an array is stored with brackets[].

  • So in order to organize our data, we created an object called users, which held an array (using brackets).

  • That object had a couple of other objects…each stored like before with curly braces {}.

  • Each element in that object was separated by commas.

<meta charset="utf-8" />
<title>JSON Data</title>
 <div id="placeholder"> </div>
var data = {
"users": [
"Firstname": "Sam",
"Lastname": "Legend",
"Age": "34"
"Firstname": "John",
"Lastname": "Watson",
"Age": "22"
 document.getElementById("placeholder").innerHTML = data.users[0].Firstname + " " + data.users[0].Lastname + " " + data.users[0].Age;