Posts

How to User Remember Me on Login By HTTPCookie

On Every application has the option to hold the User Name and Password by default on the website, either we can use it or not. On the Post going to give information on how to store cookies on browser till we clear the browser cookies. Coding as Below First How to check where any cookies is available or set by User on VB coding :  Dim UserName as String Dim Password as String Dim aCookie As HttpCookie = Request.Cookies("AppName") If Not Request.Cookies("AppName") Is Nothing Then If Not aCookie.Values("User") Is Nothing And Not aCookie.Values("Pass") Is Nothing Then UserName = aCookie.Values("User").ToString() Password = aCookie.Values("Pass").ToString() btnLogin.Focus() ElseIf Not aCookie.Values("User") Is Nothing Then UserName = aCookie.Values("User").ToString() End If End If On Add Cookies on Browser : Dim aCookie As HttpCookie = New HttpCookie("

How to Upload and Export Data From Excel File.

To Export a set of data on List we can use the DLL call NPOI.  To Download the NPOI Dll Follow the Link Below  https://npoi.codeplex.com/releases . At First to Export List to Excel the Coding as below : public FileResult ExportByLocationWise(int LocationId)         {                       //Create new Excel workbook             var workbook = new NPOI.HSSF.UserModel.HSSFWorkbook();             //Create new Excel sheet             var sheet = workbook.CreateSheet();             //font style1: underlined, italic, red color, fontsize=20             NPOI.SS.UserModel.IFont font1 = workbook.CreateFont();             font1.Color = HSSFColor.Red.Index;             font1.IsItalic = true;             font1.Underline = FontUnderlineType.Double;             font1.FontHeightInPoints = 20;             //bind font with style 1             NPOI.SS.UserModel.ICellStyle style1 = workbook.CreateCellStyle();             style1.SetFont(font1);             //(Optional) set the widt

Encrypt data in Javascript and Decrypt in Controller View

On Java Script need to use Base64 Option to encrypt the data in string as below : var Base64 = { _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (e) { var t = ""; var n, r, i, s, o, u, a; var f = 0; e = Base64._utf8_encode(e); while (f < e.length) { n = e.charCodeAt(f++); r = e.charCodeAt(f++); i = e.charCodeAt(f++); s = n >> 2; o = (n & 3) << 4 | r >> 4; u = (r & 15) << 2 | i >> 6; a = i & 63; if (isNaN(r)) { u = a = 64 } else if (isNaN(i)) { a = 64 } t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a) } return t }, decode: function (e) { var t = ""; var n, r, i; var s, o, u, a; var f = 0; e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (f < e.length) { s = this._keyStr.indexOf(e.charAt(f++)); o = this._keyStr.indexOf(e.charAt(f++)); u = this._keyStr.indexOf(e.charAt(f++)); a = this._keyStr.index

To Call Controller From Javascript in Ajax

    Normally to call the Controller Function from javascript or jquery to the controller need to use Ajax to render data Like as below : On Javascript Page Document Load : $.ajax({             url: "/GetBloggers",             type: "GET",             success: function (data) {                                 var $select = $('#Name');                 $select.html('');                                 $.each(data, function (index, value) {                     // append an <option> for each item in returned list.                                     $select.append('<option id="' + value.BloggerID+ '">' + value.Name+ '</option>');                 });             },             error: function (error) {                 alert(JSON.stringify(error));             }         })  function OnChangeName(s) {         var id = s[s.selectedIndex].id;         var name = s[

The MVC Programming Model Basic

Image
MVC is one of three ASP.NET programming models. MVC is a framework for building web applications using a MVC (Model View Controller) design: The Model represents the application core (for instance a list of database records). The View displays the data (the database records). The Controller handles the input (to the database records). The MVC model also provide s full control over HTML, CSS, and JavaScript. MVC File Structure & File Naming Standards MVC uses a standard directory structure and file naming standards which are a very important part of MVC application development. Inside the ROOT directory of the application, there must be 3 directories each for model, view and Controller. Apart from 3 directories, there must have a  Global.asax   file in root folder, and a  web.config  like a traditional ASP.NET application. Root  [directory] Controller  [directory] Controller CS files Models  [directory] Model CS files Views  [directory] View aspx/as