Posts

Showing posts from November, 2021

URL Routing and Features

Image
 URL Routing and Features The Routing is the Process by which ASP.NET Core inspects the incoming URLs and maps them to Controller Actions. It also used to generate the outgoing URLs. This process is handled by the Routing Middleware.  The Routing Middleware is available in Microsoft.AspNetCore.Routing Namespace. • The Routing has two main responsibilities: 1. It maps the incoming requests to the Controller Action 2. Generate an outgoing URLs that correspond to Controller actions.

Short note on Understanding Tag Helpers

Image
Understanding Tag Helpers Tag Helpers enable server-side code to participate in creating and rendering HTML elements in Razor files. Tag helpers are a new feature and similar to HTML helpers, which help us render HTML. Tag Helpers enable server-side code to participate in creating and rendering HTML elements in Razor files. Tag helpers are similar to HTML helpers, which help us render HTML. There are many built-in Tag Helpers for common tasks, such as creating forms, links, loading assets, etc. Tag Helpers are authored in C#, and they target HTML elements based on the element name, attribute name, or the parent tag. For example, LabelTagHelper can target the HTML <label> element. Tag Helpers reduce the explicit transitions between HTML and C# in Razor views. In order to use Tag Helpers, we need to install a NuGet library and also add an add Tag Helper directive to the view or views that use these tag helpers. In order to use Tag Helpers, we need to install a NuGet lik 46 of 111 a...

Differentiate between request and response object with example.

Request Object The Request object makes available to our script all the information that the client provides when requesting a page submitting a form. This includes the following: - the HTTP variables that identify the browser and the user, - the cookies that they have stored on their browser for this domain, and any values appended to the URL, either as a query string or in HTML, controls in a <FORM> section of the page. Response Object The Response object is used to access the response that we are creating to send back to the client.  It makes the following available to our script: the HTTP variables that identify our server and its capabilities, information about the content we're sending to the browser, and any new cookies that will be stored on their browser for this domain.  The difference between RequestObject and Response Object are as follows:- -"Request Object " is used to read the data submitted by the client (i.e. the data comes with the client request)...

What is Exception Handling? Write a suitable program how to handle exception handling.

 Exception Handling  An exception is a problem that arises during the execution of a program. A C# exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero, Array Index Out of Bounds, etc Exceptions provide a way to transfer control from one part of a program to another. C# exception handling is built upon four keywords: try, catch, finally, and throw.  try: A try block identifies a block of code for which particular exceptions are activated. It is followed by one or more catch blocks. catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception. finally: The final block is used to execute a given set of statements, whether an exception is thrown or not thrown. throw: A program throws an exception when a problem shows up. This is done using a throw keyword.  Exception...

Explain indexer class.

 An indexer allows an object to be indexed such as an array.  When you define an indexer for a class, this class behaves similar to a virtual array.  You can then access the instance of this class using the array access operator ([ ]). element-type this[int index] { get { // return the value specified by index } set { // set the value specified by index } } Example of Indexer class class Student private int roll; public int Roll { get (return roll; } set roll value; } Indexer Example } static void Main() { } private int[] marks new int[3];  public int this[int index] { get (return marks[index]; }  set (marks[index] = value; } } public double GetPercent() { double total 0.8; foreach (int in marks) { } total= total + m; return total/marks.Length; } } static void Main()  { Student s1 = new Student (); s1.Roll 1; s1[0]= 50; s1[1]=25; s1[2]=40; Console. WriteLine(s1.GetPercent() ) ; s2[0]=20; s2[1]=30; s2[2]=50; Console. WriteLine(s2.GetPercent() ) ;

Explain the design principles of the .NET framework are what make it very relevant to create. NET-based applications.

  The following design principles of the .NET framework are what make it very relevant to create. NET-based applications. Interoperability: The NET framework provides a lot of backward support Suppose if you had an application built on an older version of the NET framework, say 2.0. And if you tried to run the same application on a machine that had the higher version of the .NET framework, say 3.5. The application would still work. This is because, with every release, Microsoft ensures that older framework versions gel well with the latest version. Portability: Applications built on the .NET framework can be made to work on any Windows platform. And now in recent times, Microsoft products work on other platforms, such as iOS and Linux.  Security: The NET Framework has a good security mechanism. The inbuilt BASIC security mechanism helps in both the validation and verification of applications. Every application can explicitly define its security mechanism. Each security mechan...

Explain main component of .NET Framework.

Image
 Main Components of .NET Framework 1. Common Language Runtime (CLR):-  CIR is the basic and Virtual Machine component of the NET Framework. It is the run time environment in the NET Framework that runs the codes and helps in making the development process easier by providing various services such as remoting, thread management, type-safety, memory management, robustness, etc. Basically, it is responsible for managing the execution of NET programs regardless of any .NET programming language. It also helps in the management of code, as code that targets the runtime is known as the Managed Code, and code that doesn't target to runtime is known as code Unmanaged code. Language - The programming language is at the first level and the most common ones are VB.NET and C#  Compiler - There is a compiler that will be separate for each programming language. So, underlying the VB.NET language, there will be a separate VB.NET compiler. Similarly, , for C#, you will have C# compiler. ...

What is .NET Framework?

 Introduction to .NET Framework .NET is a software framework that is designed and developed by Microsoft.   The first version of the .Net framework was 1.0 which came in the year 2002 and the current version is 4.7.1. In easy words, it is a virtual machine for compiling and executing programs written in different languages like C#, VB.Net, etc. It is used to develop Windows Form-based applications, Web-based applications, and Web services. VB.Net and C# are the most common ones. It is used to build applications for Windows, phones, the web, etc. .NET is not a language (Runtime and a library for writing and executing written programs in any compliant language) .NET Framework supports more than 60 programming languages in which 11 are designed and developed by Microsoft,  Some of them include: C#.NET VB.NET C++.NET J#.NET F#.NET JSCRIPT.NET WINDOWS POWERSHELL

Write short notes on (Any TWO) a. Single page application b. Hidden fields c. Await patterns

  a) Single Page Application A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the webserver, instead of the default method of the browser loading entire new pages. The goal is a faster transition that makes the website feel more like a native app. In a single-page application, all necessary HTML, JavaScript, and CSS code is either retrieved by the browser with a single page load, or the appropriate resources are dynamically loaded and added to the page as necessary, usually in response to user actions. The page does not reload at any point in the process, nor does it transfer control to another page, although the location hash or the HTML5 History API can be used to provide the perception and navigability of separate logical pages in the application. b) Hidden Fields The hidden field, as the name implies, is hidden. Sometimes we require some data to be stored on the client-s...

How do you render HTML with views? Explain.

In the MVC pattern, the view handles the app's data presentation and user interaction. A view is an HTML template with embedded Razor markup. Razor markup is code that interacts with HTML markup to produce a webpage that's sent to the client. In ASP.NET Core MVC, views are .cshtml files that use the C# programming language in Razor markup. Usually, view files are grouped into folders named for each of the app's controllers. The folders are stored in a Views folder at the root of the app. Views that are specific to a controller have been created in the Views/[ControllerName] folder. To create a view, add a new file and give it the same name as its associated controller action with the .cshtml file extension. The Home controller is represented by a Home folder inside the Views folder. The Home folder contains the views for the About, Contact, and Index (homepage) webpages. When a user requests one of these three web pages, controller actions in the Home controller determine w...

Express the format of request and response message format. What is the role of adapter class in database connection?

Image
 The format of request and response message format is:-  HTTP HTTP specifications concisely define messages as "requests from client to server and responses from server to client." At its most elemental level, the role of ASP.NET is to enable server-based applications to handle HTTP messages. The primary way it does this is through HttpRequest and HttpResponse classes. The request class contains the HTTP values sent by a client during a Web request; the response class contains the values returned to the client. HTTP Request Message Format The Request-Line consists of three parts: the method token, the Request-URI, and the protocol version. Several methods are available, the most common being the POST and GET methods. The Uniform Resource Identifier (URI) specifies the resource being requested. This most commonly takes the form of a Uniform Resource Locator (URL) but can be a file or other resource. The protocol version closes out the Request-Line.  The general-header is u...

Why do we need generics? What are the significances of MSIL?

Generics  Generic is common to write a program that processes a collection - e.g. a collection of numbers, a collection of contacts, a collection of Names, etc. With generic programming, we can write code that handles a collection 'in the general' and C# handles the specifics for each collection type, saving you a great deal of work. Generic collection in C# is defined in System.Collection.Generic namespace. It provides a generic implementation of standard structures like List, Stack, Queues, Dictionaries, etc. E.g. using System;   using System.Collections.Generic;   public class GenericList   {       public static void GenericListMethod()       {           List<int> genericList = new List<int>();          // No boxing, no casting:           genericList.Add(12);           genericList.Add(...

Explain the process of compiling and executing .NET application.

Image
  The process of compiling and executing the .NET application are:-  C# programs run on the .NET Framework, which includes the common language runtime (CLR) and a unified set of class libraries. The CLR is the commercial implementation by Microsoft of the common language infrastructure (CLI), an international standard that is the basis for creating execution and development environments in which languages and libraries work together seamlessly. Source code written in any .NET languages (C#, VB.Net, etc.) is compiled into a Microsoft Intermediate Language (MSIL) or simply(IS) that conforms to the CLI specification. The IL code is stored on disk in an executable file called an assembly, typically with an extension of .exe or .dll. CLR performs just in time (JIT) compilation to convert the IL code to native machine instructions. The CLR also provides other services related to automatic garbage collection, exception handling, and resource management. Code that is executed by the C...

Differentiate between abstract class, sealed class and interface. What is the task of Object Relational Mapper?

 The differentiate between abstract class, sealed class, and interface are as follows:- Abstract Class A class is said to be an abstract class if we can’t instantiate an object of that class without creating its sub-class. Such class only exists as a parent of derived classes from which objects are instantiated. Abstract Class contains at least one abstract method. Abstract classes are used to provide an Interface for its subclasses. Classes inheriting an Abstract Class must provide a definition to the abstract method. Example:  using System; namespace ConsoleApp {   class Program   {      static void Main(string[] args)      {        Demo d;     //d is Reference Type variable of Abstract Class Demo         Demo1 d2 = new Demo1();         d = d2;         d.Display();         Console.ReadKey();       }   ...

How do you host and deploy the ASP.NET core application.

There are 2 types of hosting models in ASP.NET Core: 1. Out-of-process Hosting Model: In Out-of-process hosting models, we can either use the Kestrel server directly as a user request facing server or we can deploy the app into IIS which will act as a proxy server and send requests to the internal Kestrel server. In this type of hosting model, we have two options: a) Using Kestrel: Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the webserver that's included by default in ASP.NET Core project templates. Kestrel itself acts as edge server which directly server user requests. It means that we can only use the Kestrel server for our application. b) Using a Proxy Server: Due to the limitations of the Kestrel server, we cannot use this in all the apps. In such cases, we have to use powerful servers like IIS, NGINX or Apache. So, in that case, this server acts as a reserve proxy server which redirects every request to the internal Kestrel sever where our app is runn...

Write an application showing sql injection vulnerability and prevention using ado.net.

  Consider the following action method that validates user login. [HttpPost] public IActionResult SubmitLogin1(String uname, String pwd) {     SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=db_Mac1; Integrated Security=True");     con.Open();     SqlCommand cmd = new SqlCommand("select * from tbl_login where uname=' "+uname+" ' and password=' "+pwd+" ' ", con);     SqlDataReader dr = cmd.ExecuteReader();     if (dr.Read())     {         return Content ("Login Successful");     }     else     {        return Content("Login Unsuccessful");     } } The above action method is vulnerable to SQL injection attacks. It is because we've used the form input values name and pwd with no data validation at all including Empty form validations. Nothing bad will happen if we're sure that this value will only come from truste...

How does the system manage state in stateless HTTP? Design a page to show client side validation for login page using jquery or angular or react.

  HTTP is called a stateless protocol because each command request is executed independently, without any knowledge of the requests that were executed before it.  A few techniques can be used to maintain state information across multiple HTTP requests: 1. Cookies: A web server can assign a unique session ID as a cookie to each web client and for subsequent requests from the client they can be recognized using the received cookie. 2. Hidden fields of the HTML form:  Web server can send a hidden HTML form field along with a unique session ID as follows:         <input type = "hidden" name = "sessionid" value = "12345">         This entry means that, when the form is submitted, the specified name and value are automatically included in the GET or the POST data. Each time the web browser sends the request back, the session_id value can be used to keep the track of different web browsers. 3. URL rewriting: We can append some extra...

Explain the architecture and design principles of .NET. Create methods to insert, update, delete and read all data for the table Student having following fields StudentId(int), Name varchar(200), RollNo (int), Class varchar(50) using Entity Framework.

Image
  NET is tiered, modular, and hierarchal. Each tier of the .NET Framework is a layer of abstraction. .NET languages are the top tier and the most abstracted level. The common language runtime is the bottom tier, the least abstracted, and closest to the native environment. This is important since the common language runtime works closely with the operating environment to manage .NET applications. The .NET Framework is partitioned into modules, each with its own distinct responsibility. Finally, since higher tiers request services only from the lower tiers, .NET is hierarchal. The architectural layout of the .NET Framework is given below.             Figure: An overview of the .NET architecture. Common Language Runtime (CLR) is the heart of the .Net Framework. It resides above the operating system and handles all .Net applications. It handles garbage collection, Code Access Security (CAS), etc. Common Language Infrastructure (CLI) provides a language-in...

Describe the MVC pattern. Create a class to showcase the constructor, properties, indexers, and encapsulation behavior of the object-oriented language.

Image
The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components is built to handle specific development aspects of an application. Model: Model represents the structure of data, the format and the constraints with which it is stored. It maintains the data of the application. Essentially, it is the database part of the application. View: View is what is presented to the user. Views utilize the Model and present data in a form in which the user wants. A user can also be allowed to make changes to the data presented to the user. They consist of static and dynamic pages which are rendered or sent to the user when the user requests them. Controller: Controller controls the requests of the user and then generates appropriate response which is fed to the viewer. Typically, the user interacts with the View, which in turn generates the appropriate request, this request...

Consider you are given a role of SEO analyst to perform search engine optimization analysis of www.sastodeal.com, what kind of SEO activities you will perform so as to improve rank of the website.

Image
If I were an SEO analyst of www.sastodeal.com then my fundamental role will be to increase the number of people who visit a website or a number of websites. SEO stands for 'search engine optimization, I include the following responsibilities: I'll carry out keyword research using software such as Moz to optimize web content I'll track metrics such as organic traffic, conversion rates, and time spent on the page using platforms such as Google Analytics I'll monitor and report on search trends and SEO performance I'll analyze websites and social media pages to make recommendations for improvement I'll perform competitor analysis to identify content gaps and areas for improvement in website design, and I'll stay up to date with new SEO, social media, and digital marketing industry trends, tools, and practices, which are constantly changing I'll use Excel spreadsheets to compile reports I'll implement link-building strategies I'll make suggestions fo...

Describe how promoted tweets, promoted trends and lead generation cards are used as Twitter marketing tools?

Image
There are many kinds of Twitter marketing products, and the firm is creating new ones every few months. The current major Twitter marketing tools include the following. Promoted Tweets Promoted Trends Promoted Accounts Enhanced Profile Page Amplify Promoted Videos Television Ad Retargeting Lead Generation Cards i) Promoted Tweets:   Advertisers pay to have their tweets appear in users' search results. Promoted Tweets are Twitter's version of Google's AdWords. The tweets appear as "promoted" in the search results. Pricing is on a "cost-per-click" basis, based on an auction run by Twitter on the Twitter ad platform, and might range from $.50 to $10 per engagement. An "ad carousel" allows up to 12 ads to be shown in a single space, enabling users to swipe through the Promoted Tweets. Promoted Tweets can be geotargeted and also offer keyword targeting that enables advertisers to send the tweets to specific users based on keywords in their recent tw...

How linear, non-linear, in-banner, and in-text video ads are used for digital marketing?

Image
Linear, Non-Linear, In-banner, and in-text video ads are described below:- i) Linear Video Ads:  More commonly known as pre, mid and post-roll ads, linear ads take over the full video player space. They're linear because they run in line sequentially with the content, for example, a pre-roll will appear as (ad-video); a mid-roll will be (video-ad-video) and a post-roll will appear as (video-ad). Linear ads can be 15 or 30-seconds long and do not allow for fast-forwarding through the ad. OR, Linear Video Ads are the most iconic and widespread formats of in-stream video advertising. Just like in the traditional TV broadcasts, they are cutting into the main video and playing in-line with the rest of the content. Linear ad interrupts the primary video and occupies the entire video-played space. It can encompass the interactive component or work with a companion ad. ii) Non-linear Video ad: runs parallel to the video content so the users see the ad while viewing the content. Non-linear...

Discuss the possible security threats in e-commerce systems

Image
Security threats in e-commerce systems The different types of security threats in e-commerce systems are described below: i) Malicious Code viruses, worms, Trojan horses, ransomware, and bots. ii) Adware iii) Spyware iv) Social Engineering v) Phishing vi) Hacking vii) Credit Card Fraud and Identity Fraud Any five of them are described below: i) Malicious Code:   Malicious code (sometimes referred to as "malware"). Malware is any software intentionally designed to cause damage to a computer, server, client, or computer network. Malware includes a variety of threats such as viruses, worms, Trojan horses, ransomware, and bots. ii) Adware:  Adware is a form of threat where the computer starts for pop-up ads to display when th user visits certain sites. Adware is not typically used for criminal activities but it can be pretty annoying. iii) Spyware:  Spyware can be used to obtain information such as a user's keystrokes, copies of email and instant messages, and even take scree...

What is a shopping cart in an e-commerce application? How can you build shopping carts?

Image
 Shopping art  A shopping cart software is an eCommerce tool that allows web visitors top services offered on a website. We can add and remove items as we wish. jus. id. It is used by online merchants to streamline the web buyer's experience and make it possible to select, reserve, and store items from a website. A shopping cart tool also handles online payments with payment gateway integrations. For online merchants, shopping cart software is an integral part of the business. Several vendors offer this type of software, each providing various features to help you out with your online business. Shopify, Magento, woo commerce, Wix,x-cart, etc are the websites which are using shopping carts. Benefits of shopping cart software to customers:  Safe shopping experience More payment options View more detailed product descriptions Save items and return at a later date Express checkout Track orders in real-time

What is e-payment? Describe the working mechanism of online credit card transaction.

Image
E-payment An e-payment system is a way of making transactions or paying for goods and services through an electronic medium, without the use of checks or cash. It's also called an electronic payment system or an Online payment system. Pros: Potential for great flexibility Low transaction costs Rapid and diverse purchase power How online credit card transaction works  Some information about How online credit card transaction works  Processed in much the same way that in-store purchases are  The major difference is that online merchants do not see or take an impression of a card, and no signature is available.  Participants include consumer, merchant, clearinghouse, merchant bank (acquiring bank), and consumer’s card issuing bank  Five parties involved in this transaction a) Consumer  b) Merchant  c) Clearinghouse  d) Merchant bank  e) Issuing bank Step 1:-  When the customer wants to pay, a secret tunnel through the internet is created us...

Describe the possible types of revenues models that can be adapted in e commerce systems.

Image
Revenue model A firm's revenue model describes how the firm will earn revenue, generate profits, and produce a superior return on invested capital. capital. We use the terms revenue model and financial model interchangeably.  There are many different e-commerce revenue models that have been developed followings are the types of revenue models: ➤Types of Revenue Model the advertising model,  the subscription model, the transaction fee model, the sales model, and the affiliate model. i. The advertising model:   In the advertising revenue model, a company that offers content, services, and/or products also provides a forum for advertisements and receives fees from advertisers. Companies that are able to attract the greatest viewership or that have a highly specialized, differentiated viewership and are able to retain user attention are able to charge higher advertising rates. Yahoo, for instance, derives a significant amount of revenue from display and video. ii. The subscri...

How the features like ubiquity, information density, and richness make e-commerce better than traditional commerce. Justify with examples

Image
There are four major characteristics of e-commerce: i. Ubiquity ii. Global Reach iii. Information Richness iv. Information density v. Personalization and Customization vi. Interactivity i. Ubiquity: Because E-Commerce is ubiquitous, the market is able to extend its traditional operating hours. Online stores never close, it is available everywhere at any time. Ubiquity lowers transaction costs for the consumer/buyer. For example, if the user is at an outstation, he also can through www.acer.com get information about the product. ii. Information Richness: Advertising and branding are important parts of commerce. E-Commerce can deliver video, audio, animation, etc. to introduce products. Individuals may see information richness if a post contains a video related to a product and hyperlinks that allow him/her to look at or purchase the product and send information about the post via text message or email. An example is the richness is can make the websites become attract people to browse. ...

What is e-commerce? How does it differ from e-business?

Image
Ecommerce Ecommerce, also known as electronic commerce or internet commerce, refers to the buying and selling of goods or services using the internet, and the transfer of money and data to execute these transactions. Examples of E-Commerce are online retailers like Amazon, Flipkart, Myntra, Paytm mall, seller  Activities of E-Commerce are: Buying and selling products online Online ticketing Online Payment Paying different taxes Online accounting software Online customer support The difference between E-commerce and E-business are as follows:-  E-commerce The trading of merchandise, over the internet, is known as E-commerce. E-Commerce is a narrow concept and it is considered a subset of E-Business.  Commercial transactions are carried out in e-commerce. In e-commerce transactions are limited. It involves mandatory use of the internet. E-commerce is more appropriate in the Business to Customer (B2C) context. E-Business Running a business using the internet is known as E-bu...

Consider a company is planning to establish a B2B e-commerce system. Now describe in detail the possible types of B2B Business Models the company can adapt.

Image
The major business models used to date in the B2B arena include:  i) Net marketplaces  E-distributors  E-procurement  Exchange Industry Consortium ii) Private Industrial Network Single Firm Private Industrial  Network Industry-wide Private Network  i) Net marketplaces a)  E-distributor:   E-distributors is a company that supplies products and services directly to individual businesses. E-distributors are owned by one company seeking to serve many customers. In E-distributors the more products and services a company makes available on its sites, the more attractive that site is to potential customers. The revenue model of e-distributors is Sales of goods, Advertisements. Example: Grainger.com is are owned e-distributors with online catalogs used to access and provide information on over 1 million items.   b) E-procurement:  These firms create and sell access to digital markets. The Revenue model of E-procurement is fees for market-making ...