0% found this document useful (0 votes)
15 views3 pages

ASP.Net Core MVC Lab Tasks Guide

The document outlines a series of lab tasks for a Net Centric Computing course, requiring students to create various ASP.Net Core MVC projects with specific features and functionalities. Tasks include creating Razor view pages, models, controllers, and implementing database operations using SQL Server, as well as demonstrating client-side development with Angular and React. Additionally, students are instructed to showcase authentication, authorization, and hosting of their applications, along with providing necessary screenshots and configurations.

Uploaded by

allmightultra559
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

ASP.Net Core MVC Lab Tasks Guide

The document outlines a series of lab tasks for a Net Centric Computing course, requiring students to create various ASP.Net Core MVC projects with specific features and functionalities. Tasks include creating Razor view pages, models, controllers, and implementing database operations using SQL Server, as well as demonstrating client-side development with Angular and React. Additionally, students are instructed to showcase authentication, authorization, and hosting of their applications, along with providing necessary screenshots and configurations.

Uploaded by

allmightultra559
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lab Works (Net Centric Computing)

Remaining Lab tasks (Net Centric Computing) /Lab Works Part -2

[For the lab tasks below, please write the source codes for Controllers, Models, Other required
classes and the Razor view pages with corresponding names. Mention about the configuration
used (write only the statements used). You must mention about the packages installed and
namespaces used in your code. You must attach the screenshots after rendering in browser)]

18. Create a [Link] Core MVC project including your name in application name (If your name
is Hari then project name should be "WebApp1ByHari". Include the following pages and
features :
 A Razor view page that displays
 current date and time
 your name and roll no.
 multiplication table of your_roll_no + 1 (if your roll no. is 5, table of 6 should
be displayed)

Link this page in navbar with menu "MyRazorPage".

 A Model class “Student” that has some properties like StdID, Name, Address, Faculty
etc. and annotate them with necessary validation attributes.
 Another Razor page to design a form that can be used to set values to the model object.
(use built-in tag helpers and validation attributes while creating the form and model,
server side validation should be performed)
Link this page in navbar with menu "Create Student Record".
 Another Razor page to display the detail of a student.
 A Controller containing action methods to render above Razor view pages
 When submit button is pressed, redirect to another Razor page and display the details
of the student if the model validation is successful then show the error message next
to the form fields in red color if model validation fails. [ include screenshots of form
submission with valid and invalid cases in report]
19. Create a project to illustrate dependency injection in [Link] Core. (If your name is Shyam
then project name should be "WebApp2ByShyam")

[Use SQL Server RDBMS and SSMS to create database and tables for following Lab tasks)

1 Collected by Bipin Timalsina


Lab Works (Net Centric Computing)

20. Create a Console application in C# to demonstrate insert, read, update and delete operations
in database. (Mention the table structure in theory and include the necessary screenshots of
database values
21. Create a CRUD application using [Link] Core MVC template using [Link].
(If your name is Radha then project name should be "WebApp3ByRadha")
22. Create a CRUD application using [Link] Core MVC template using Entity Framework Core
code first approach.
(If your name is Krishna then project name should be "WebApp4ByKrishna")

23. Create an [Link] Core application to demonstrate Entity Framework Core database first
approach.
(If your name is Bhim then project name should be "WebApp5ByBhim")
24. Create a simple Web API using [Link] Core and Entity Framework Core. Show the API
testing steps using both Postman and Swagger.
(If your name is Arjun then project name should be "WebApiByArjun")
25. Create an [Link] application to demonstrate state management using Session state,
HttpContext, TempData, Cookies, Query Strings and Hidden field.
(If your name is Asim then project name should be "WebApp6ByAsim")
26. Client side development in [Link] core
a) Create a sign up form and perform validation using jQuery.
[The page should dsiplay your name and RollNo at the top of the form]
b) Create an Angular application having a navbar and a footer. The navbar should have
two menus- home and calculator. The footer should display ©YourName, Current Date
(year). The home page should display your own photo. When calculator menu is clicked
a form should be displayed and the form should contain :
 two text fields to accept two numbers,
 a dropdown list with options add, subtract, and multiply,
 a button showing "Compute"
 a label displaying the computed result (after pressing the button) based on the
option chosen
(If your name is Parbati then project name should be "AngularAppByParbati")

2 Collected by Bipin Timalsina


Lab Works (Net Centric Computing)

c) Create similar application as in (b) using React


(If your name is Sabitri then project name should be "ReactAppBySabitri")
27. Create an [Link] Core application to demonstrate authentication and authorization.
(If your name is Sita then project name should be "WebApp7BySita")
28. Hosting an [Link] Core Application

Host the application created in Lab 23 in any free hosting platform /server and show all the
steps with screenshots.

3 Collected by Bipin Timalsina

Common questions

Powered by AI

ADO.Net provides a low-level approach to database interaction, allowing fine-grained control over queries and operations by directly executing SQL commands or stored procedures. It's efficient for scenarios requiring optimized data access but demands more effort in managing connections and interactions manually. Entity Framework Core, conversely, is an ORM that abstracts the database interaction layer, offering a high-level approach through LINQ queries and object models. This simplifies CRUD operations by managing data context but might introduce performance overheads compared to ADO.Net. While ADO.Net is suited for high-performance needs, EF Core enhances developer productivity through ease of use and quick development cycles .

Implementing authentication and authorization in an ASP.Net Core application involves configuring identity management within the Startup class, specifying authentication schema, and setting up middleware for handling different authentication events. Essential steps include registering services like UserManager and SignInManager, configuring cookie policies or JWT tokens for authentication types, and defining policies for authorization requirements. User roles and claims must be appropriately managed to ensure precise access controls. Testing involves verifying users authenticate correctly and unauthorized access redirects are handled, ensuring only authenticated users can access protected resources .

The 'Student' model class in an ASP.Net Core MVC application serves as a blueprint for data transfer and validation. It encapsulates student data like ID, name, and address and is annotated with validation attributes such as [Required] or [StringLength] to ensure data integrity. During form submissions, the model binding framework binds incoming request data to model properties while applying validation rules. If validation fails, error messages are generated, displayed alongside form fields in red, improving data correctness before storage or further processing. This ensures server-side verification of data consistency before operations like database insertion .

Hosting an ASP.Net Core application on a free platform enables testing and deployment without incurring setup and maintenance costs. It provides immediate user access through publicly accessible URLs, facilitating client feedback and iterative development. Free platforms often offer integral deployment pipelines, simplifying updates and enabling continuous integration. While beneficial for initial testing phases, free hosting may have limitations in performance, storage, and scalability, which needs consideration in production environments where paid hosting could be more reliable and robust .

To implement client-side validation using jQuery in an ASP.Net Core application, dynamically include jQuery libraries in your layout or view page. Define a signup form with input fields and use jQuery selectors to attach validation functions to these fields. Implement functions to trigger validation events on form submission or input changes. For example, use the `blur` event to validate email format or password length, providing immediate feedback to users before form submission. Using jQuery's validation plugin can simplify this process by providing predefined rules that can trigger error messages dynamically, ensuring that client-side checks complement server-side validation seamlessly .

State management in an ASP.Net application can be implemented through various mechanisms like Session state, Cookies, TempData, Query Strings, and Hidden Fields. Session state stores data on the server per user session, useful for sensitive information, with information stored until the session expires. Cookies, however, store data client-side within browsers and can persist over multiple sessions. Sessions provide better security, whereas cookies are ideal for less critical data requiring persistence beyond session lifetime. Using HttpContext or accessing Session state directly allows managing user session data effectively, crucial for personalized user experiences .

To create an ASP.Net Core MVC project with a Razor view displaying personal information and a multiplication table, first, set up the project with a name including your identifier (e.g., 'WebApp1ByHari'). Install necessary packages such as Microsoft.AspNetCore.Mvc and ensure the application is using appropriate namespaces for Razor pages. Create a Controller managing action methods to render Razor views. Design a Razor view to display the current date and time, personal name, roll number, and a multiplication table of roll_number + 1. Add this page to the navbar as 'MyRazorPage.' Configuration for packages and namespaces is crucial, and all steps must be rendered in the browser with screenshots illustrating outcomes .

To implement an Angular application with a calculator feature, set up an Angular project and create components for navbar, home, and calculator views. The navbar should include links to navigate between the home and calculator pages. Develop the calculator component with input fields for two numbers, a dropdown for operations (add, subtract, multiply), and a button to perform calculations. Implement Angular event handling to compute and display results upon button clicks. Use Angular's binding and directives for dynamic updates, ensuring computations reflect on the client-side interface seamlessly, enhancing user interactivity and experience .

In ASP.Net Core, dependency injection is a technique for achieving Inversion of Control (IoC) between classes and their dependencies, leading to increased modularity and testability. It works by registering services within the application's startup class and injecting them into constructors of classes that require them. Benefits include reduced coupling between components, improved code maintainability, and easier unit testing since mocks can be used in place of actual service implementations. Setting up dependency injection involves configuring services in the ConfigureServices method of the Startup class and using constructor injection to access these services within controllers or other classes .

Creating a Web API in ASP.Net Core using Entity Framework Core involves several steps. First, set up a new ASP.Net Core Web API project and configure Entity Framework Core with a database context and model classes. Develop controllers to handle HTTP requests and serialize/deserialize data. For testing the API, use tools like Postman or Swagger to send requests and view responses, verifying endpoints support operations like GET, POST, PUT, and DELETE. Create a Swagger specification to document your API, aiding automated client generation and interaction. Testing ensures API endpoints function correctly, data integrity is preserved, and performance aligns with expectations .

You might also like