Question Answer
Question Answer
Answer:
It provides fantastic integration of HTML, CSS and JavaScript. It was first released in
January 2002.
It is built on the Common Language Runtime (CLR) and allows programmers to write code
using any supported .NET language.
1. Web Forms
2. ASP.NET MVC
3. ASP.NET Web Pages
Advantage
1) Security
Yes, we did mention security as one of the advantages of the framework. But
apparently, extra care should be taken to protect the applications.
2) Costly
3) Documentation is not exactly up to the mark
4) ASP.NET core not good enough
5) Making changes in the app
Changes might not work in the next version of your app. What works in the current
version, works, but in the next, you might have to get help from GitHub.
6) Porting ASP application from one server to another is expensive
ASP.NET - Validators
ASP.NET validation controls validate the user input data to ensure that useless,
unauthenticated, or contradictory data don't get stored.
RequiredFieldValidator
RangeValidator
CompareValidator
RegularExpressionValidator
CustomValidator
ValidationSummary
RequiredFieldValidator Control
The RequiredFieldValidator control ensures that the required field is not empty. It is
generally tied to a text box to force input into the text box.
<asp:RequiredFieldValidator ID="rfvcandidate"
runat="server" ControlToValidate ="ddlcandidate"
ErrorMessage="Please choose a candidate"
InitialValue="Please choose a candidate">
</asp:RequiredFieldValidator>
RangeValidator Control
The RangeValidator control verifies that the input value falls within a predetermined range.
Properties Description
It defines the type of the data. The
Type available values are: Currency, Date,
Double, Integer, and String.
</asp:RangeValidator>
CompareValidator Control
The CompareValidator control compares a value in one control with a fixed value or a value
in another control.
Properties Description
RegularExpressionValidator
</asp:RegularExpressionValidator>
CustomValidator
The CustomValidator control allows writing application specific custom validation routines
for both the client side and the server side validation.
</asp:CustomValidator>
ValidationSummary
The ValidationSummary control does not perform any validation but shows a summary of all
errors in the page. The summary displays the values of the ErrorMessage property of all
validation controls that failed validation.
The following two mutually inclusive properties list out the error message:
There are two types of State management in ASP net. They are :
Server-side
Client-side
These are further subdivided into the following -
Server-Side
Session
Application
Cache
Client-Side
Cookies
Viewstate
Control state
Query String
Hidden Field
Session[“name”]=”Meera Academy”;
Response.Redirect(“nextpage.aspx”);
C# code for set session value on first page “default.aspx” on button click events. After
assigning a value to session we redirect to other page “next.aspx” using response.redirect
method. Here, we assign textbox name value to Session[“name”] and city value to
Session[“city”] and redirect to next.aspx page.
protected void btnsession_Click(object sender, EventArgs e)
{
Session["name"] = txtname.Text;
Session["city"] = txtcity.Text;
Response.Redirect("next.aspx");
}
On “next.aspx” page we retrieve and display session value on web page using label control.
C# code on “next.aspx” page for retrieve session value.
Caching in ASP.NET
Output Caching : Output cache stores a copy of the finally rendered HTML pages or
part of pages sent to the client. When the next client requests for this page, instead of
regenerating the page, a cached copy of the page is sent, thus saving time.
Data Caching : Data caching means caching data from a data source. As long as the
cache is not expired, a request for the data will be fulfilled from the cache. When the
cache is expired, fresh data is obtained by the data source and the cache is refilled.
Object Caching : Object caching is caching the objects on a page, such as data-bound
controls. The cached data is stored in server memory.
Class Caching : Web pages or web services are compiled into a page class in the
assembly, when run for the first time. Then the assembly is cached in the server. Next
time when a request is made for the page or service, the cached assembly is referred
to. When the source code is changed, the CLR recompiles the assembly.
Configuration Caching : Application wide configuration information is stored in a
configuration file. Configuration caching stores the configuration information in the
server memory.
Output Caching
Object Caching
Cache["key"] = item;
Question 3: What are the concept of Globalization and Localization in .NET ? Explain Web
Config File in ASP.
In the context of software development and the .NET framework, globalization and
localization are two important concepts that deal with making applications adaptable to
different cultures, languages, and regions.
Example:
1.
<configuration>
<appSettings>
<add key="Application Name" value="MyApplication" />
</appSettings>
</configuration>
2.
<configuration>
<appSettings>
<add key="appISBN" value="0-273-68726-3" />
<add key="appBook" value="Corporate Finance" />
</appSettings>
</configuration>
3.
<connectionStrings>
<add name="name"
connectionString="Constring"
providerName="System.Data.OleDb" />
</connectionStrings>