IIS integrated security=SSPI

Informatics webapp can be connected using
a)SQL authentication (not recommended)
b) Windows account credentials (recommended)

Example connection string using SQL authentication
**************************************************

Example connection string using Windows account credentials
***********************************************************

When Integrated Security = false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true.

Complete guidance to setup windows authentication is on this link:-
https://docs.microsoft.com/en-us/previous-versions/msp-n-p/ff647396(v=pandp.10)

NOTE:-
Example:- Assuming the webserver is part of the Domain Admins

Step 1) Add ROYALSURREY\Domain Admins to the Server(RSCH-INFODEV)->Security->Logins
Step 2)Goto->Server(RSCH-INFODEV)->Security->ServerRoles->sysadmin (double click sysadmin and add ROYALSURREY\Domain Admins)

Why Javascript on ASP.NET

client side vs server side

Javascript runs on the client machine. The event handling is done on that clients machine without talking to the server.

ASP.NET code behind event handling is done on the server. When an event happens the client talks to the server, the server handles the event and talks back to the client.

The latter requires a round trip over the network and most likely a page postback (unless it’s an async webmethod).

Doing it with JavaScript means it’s done locally without the page refreshing, it’s done faster and there less stress on the server.

Of course if your event handling is manipulating the database then it should be handled by the server. If it’s manipulating the page it should be handled by the client.

Page Life Cycle With Examples in ASP.Net

copied from http://www.c-sharpcorner.com/UploadFile/8911c4/page-life-cycle-with-examples-in-Asp-Net/

 

 

PreInit

  1. Check the IsPostBack property to determine whether this is the first time the page is being processed.
  2. Create or re-create dynamic controls.
  3. Set a master page dynamically.
  4. Set the Theme property dynamically.

    ASP.NET1.jpg

Note

If the request is a postback then the values of the controls have not yet been restored from the view state. If you set a control property at this stage, its value might be overwritten in the next event.

Init

  1. This event fires after each control has been initialized.
  2. Each control’s UniqueID is set and any skin settings have been applied.
  3. Use this event to read or initialize control properties.
  4. The “Init” event is fired first for the bottom-most control in the hierarchy, and then fired up the hierarchy until it is fired for the page itself.

    ASP.NET2.jpg

InitComplete

  1. Until now the viewstate values are not yet loaded, hence you can use this event to make changes to the view state that you want to ensure are persisted after the next postback.
  2. Raised by the Page object.
  3. Use this event for processing tasks that require all initialization to be complete.

    ASP.NET3.jpg

OnPreLoad

  1. Raised after the page loads view state for itself and all controls, and after it processes postback data that is included with the Request instance.
  2. Before the Page instance raises this event, it loads view state for itself and all controls, and then processes any postback data included with the Request instance.
  3. Loads ViewState: ViewState data are loaded to controls.
  4. Loads Postback data: Postback data are now handed to the page controls.

    ASP.NET4.jpg

Load

  1. The Page object calls the OnLoad method on the Page object, and then recursively does the same for each child control until the page and all controls are loaded. The Load event of individual controls occurs after the Load event of the page.
  2. This is the first place in the page lifecycle that all values are restored.
  3. Most code checks the value of IsPostBack to avoid unnecessarily resetting state.
  4. You may also call Validate and check the value of IsValid in this method.
  5. You can also create dynamic controls in this method.
  6. Use the OnLoad event method to set properties in controls and establish database connections.

    ASP.NET5.jpg

Control PostBack Event(s)

  1. ASP.NET now calls any events on the page or its controls that caused the PostBack to occur.
  2. Use these events to handle specific control events, such as a Button control’s Click event or a TextBox control’s TextChanged event.
  3. In a postback request, if the page contains validator controls, check the IsValid property of the Page and of individual validation controls before performing any processing.
  4. This is just an example of a control event. Here it is the button click event that caused the postback.

    ASP.NET6.jpg

LoadComplete

  1. Raised at the end of the event-handling stage.
  2. Use this event for tasks that require that all other controls on the page be loaded.

    ASP.NET7.jpg

OnPreRender

  1. Raised after the Page object has created all controls that are required in order to render the page, including child controls of composite controls.
  2. The Page object raises the PreRender event on the Page object, and then recursively does the same for each child control. The PreRender event of individual controls occurs after the PreRender event of the page.
  3. The PreRender event of individual controls occurs after the PreRender event of the page.
  4. Allows final changes to the page or its control.
  5. This event takes place before saving ViewState, so any changes made here are saved.
  6. For example: After this event, you cannot change any property of a button or change any viewstate value.
  7. Each data bound control whose DataSourceID property is set calls its DataBind method.
  8. Use the event to make final changes to the contents of the page or its controls.

    ASP.NET7.5.jpg

OnSaveStateComplete

  1. Raised after view state and control state have been saved for the page and for all controls.
  2. Before this event occurs, ViewState has been saved for the page and for all controls.
  3. Any changes to the page or controls at this point will be ignored.
  4. Use this event perform tasks that require the view state to be saved, but that do not make any changes to controls.

    ASP.NET8.jpg

Render Method

  1. This is a method of the page object and its controls (and not an event).
  2. The Render method generates the client-side HTML, Dynamic Hypertext Markup Language (DHTML), and script that are necessary to properly display a control at the browser.

UnLoad

  1. This event is used for cleanup code.
  2. At this point, all processing has occurred and it is safe to dispose of any remaining objects, including the Page object.
  3. Cleanup can be performed on:
    • Instances of classes, in other words objects
    • Closing opened files
    • Closing database connections.
  4. This event occurs for each control and then for the page.
  5. During the unload stage, the page and its controls have been rendered, so you cannot make further changes to the response stream.
  6. If you attempt to call a method such as the Response.Write method then the page will throw an exception.

ASP.NET MVC Version History

ASP.NET MVC Version History

Microsoft had introduced ASP.NET MVC in .Net 3.5, since then lots of new features have been added.

The following table list brief history of ASP.NET MVC.

MVC Version Visual Studio .Net Version Release date Features
MVC 1.0 VS2008 .Net 3.5 13-Mar-2009
  • MVC architecture with webform engine
  • Routing
  • HTML Helpers
  • Ajax Helpers
  • Auto binding
MVC 2.0 VS 2008, .Net 3.5/4.0 10-Mar-2010
  • Area
  • Asynchronous controller
  • Html helper methods with lambda expression
  • DataAnnotations attributes
  • Client side validation
  • Custom template
  • Scaffolding
MVC 3.0 VS 2010 .Net 4.0 13-Jan-2011
  • Unobtrusive javascript validation
  • Razor view engine
  • Global filters
  • Remote validation
  • Dependency resolver for IoC
  • ViewBag
MVC 4.0 VS 2010 SP1,
VS 2012
.NET 4.0/4.5 15-Aug-2012
  • Mobile project template
  • Bundling and minification
  • Support for Windows Azure SDK
MVC 5.0 VS 2013 .NET 4.5 17-oct-2013
  • Authentication filters
  • Bootstrap support
  • New scaffolding items
  • ASP.Net Identity
MVC 5.2 – Current VS 2013 .NET 4.5 28-Aug-2014
  • Attribute based routing
  • bug fixes and minor features upate

Use Static Files in ASP.NET Core (Latest with CProj file)

If .net Core app uses csproj add the following line:

<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />

Or run the command

dotnet add <ProjectName for ex TheWorld> package Microsoft.AspNetCore.StaticFiles


There is no package.json file to modify anymore, and there’s no “StaticFileMiddleware” middleware package. This stuff (and Angular 2 & 4) are changing so damn fast