
What is the MVC pattern?
The Model-View-Controller (MVC) architectural pattern separates an application into three main groups of components: Models, Views, and Controllers. This pattern helps to achieve separation of concerns. Using this pattern, user requests are routed to a Controller which is responsible for working with the Model to perform user actions and/or retrieve results of queries. The Controller chooses the View to display to the user, and provides it with any Model data it requires … full article
What is Session?
Session – Is to keep track of each user’s request. So each time the web page is posted back asp.net runtime knows from which user the request is coming from. Now since HTTP is a stateless protocol, meaning each request from the same user is like a new request to it. So, to maintain a session Asp.Net has Session variables.
Session Variables- The session variables are variables maintained on server side by asp.net runtime. Each user is identified by a a unique number called SessioID. This session is stored in a cookie (if browser supports cookie) on client side after the first user request. when the client posts back a page , this cookie is available in the request header. So now server knows that this user request is coming from which user. Besides this you can also store user specific information in session variables, which will be availale on server side.
Sending Email with SendGrid
provides a cloud-based email delivery service that assists businesses with email delivery. The service manages various types of email including shipping notifications, friend requests, sign-up confirmations, and email newsletters. It also handles internet service provider (ISP) monitoring, domain keys, sender policy framework (SPF), and feedback loops.Additionally, the company provides link tracking, open rate reporting. It also allows companies to track email opens, unsubscribes, bounces, and spam reportsfull article
Click here for SendGrid home page
Sending email with local SMTP
for example download: tucows free (10 emails per day)
code demo: download here
Sending email with gmail SMTP
Update security level in gmail (single-factor):


console app code demo: download here
verify email project: download here
What are ASP.NET Razor Pages?
Razor is an ASP.NET programming syntax used to create dynamic web pages with the C# (or VB.NET) programming languages.
The Razor syntax is a template markup syntax, based on the C# programming language, that enables the programmer to use an HTML construction workflow. Instead of using the ASP.NET Web Forms (.aspx) markup syntax with <%= %> symbols to indicate code blocks, Razor syntax starts code blocks with an @ character and does not require explicit closing of the code-block.
The idea behind Razor is to provide an optimized syntax for HTML generation using a code-focused templating approach, with minimal transition between HTML and code. The design reduces the number of characters and keystrokes, and enables a more fluid coding workflow by not requiring explicitly denoted server blocks within the HTML code.
Other advantages that have been noted: (1) Supports IntelliSense – statement completion support (2) Supports “layouts” – an alternative to the “master page” concept in classic Web Forms (.aspx) (3) Unit testable
Razor was in development in June 2010 and was released for Microsoft Visual Studio 2010 in January 2011. Razor is a simple-syntax view engine and was released as part of MVC 3 and the WebMatrix tool set. Razor became a component of AspNetWebStack and then became a part of ASP.NET Core … full article
Example:
More topics covered:
- Creating MVC controller
- Creating Razor page
- Adding dynamic data to the page
- Index is default
- return View (” Page Name “)
- return Content (“ HTML …“);
- return Redirect (” URL “);
- return new FilePathResult (” Path-HTML-File “);
- Getting query string from url
- HttpContext.Application vs Session
- Storing data in Session
- Storing data in Application
- HTML page
- MCV default web page – Home
- MVC layout template
Links:
- Class code: Page controller demo
- Class code: Session vs Application
- Class code: Razor pages
- Class code: demo HTML error page
- Class code: Sending email with SendGrid
- Youtube code
- Razor syntax – w3schools
- Razor vs MVC – nice article
- Lesson Summary Video!












