EDUDOTNET

Monday, April 29, 2013

ASP.NET MVC: DROPDOWNLIST WITH ENUM




Create Drop-down list with enum values in MVC:




Inside model we need to define:
    1. a property of enum type.
    2. a property of SelectedListItem as IEnumerable.
    3. Inside constructor filling Dropdown list from enum.
ASP.NET MVC: DROPDOWNLIST WITH ENUM
Model
Enum (County list):
ASP.NET MVC: DROPDOWNLIST WITH ENUM
Enum

Action (Creating object of model and return model):
ASP.NET MVC: DROPDOWNLIST WITH ENUM
Action

View (Calling mode on top and filling dropdown list)
ASP.NET MVC: DROPDOWNLIST WITH ENUM
View







Sunday, April 28, 2013

ROUTING IN ASP.NET MVC

URL Routing in MVC
URL Routing:-

Generally, URL Routing/Rewiring is a URL pattern matching system that monitor the browser request and heck out what to do with that browser request. The Routing module is responsible for mapping incoming browser requests to particular ASP.NET MVC controller actions. We can to make very pretty URLs more flexible. We can create "Route Table" inside the application`s "Global.asax" file.

Routing system divided in two part:-
  1. RouteData: This Technic is used to investigate an incoming URL and then check which controller and action the request is need to be send.
  2. VirtualPath: This Technic is responsible for generating Outbound URL. These are the URLs that appear in the HTML rendered from our views so that a specific action will be invoked when the user clicks the link. 

Sample Code:-
           //Default url
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                "Default",
                "",
                new { controller = "Home", action = "Index", id = "" }
            );
            //others URL rewriting you want
            routes.MapRoute(null,
                "Search/{City_State}/{ID}",
                new { controller = "Home", action = "Search" }
                );
When the routing module finds a exact in the route table for the incoming browser request's URL, it forwards the request to the suitable controller and action.


Thursday, April 25, 2013

Generate a CSR (Certificate Signing Request) : IIS 7

How generate a Certificate Signing Request (CSR) in IIS7


  1. Open IIS(Internet Information Services)
    1. On the Start menu, click All Programs, click Accessories, and then click Run.
    2. In the Open dialog box, type inetmgr and then click OK.
  2. See the below IIS window 
    1. After that you can find "Server Certificate" Under IIS section from the center menu section and double click on this. You can highlighted with square border.
  3. After double click you see below window and go to right pane under "Action" menu and click on "Create Certificate Request" (highlighted) in this screenshot.
  4. Enter the Distinguished Name information in the Distinguished Name Properties window 
  5. Click on Next button
  6. In the "Cryptographic Service Prover Properties" window, select cryptographic service provider "Microsoft RSA SChannel Cryptographic Provider" from dropdown list and select "Bit length"  "2048" from dropdown list and click on Next button
  7. Enter the location and file of CSR or Choose location using browse button near textbox.  After click on FINISH button
  8. You can find CSR txt file in your exact location and open the file and you can see CSR code between  ----CERTIFICATE REQUEST---- and ----END CERTIFICATE REQUEST---- 
  9. You can copy the code and page into online request form.