Web Development CAP426 HW3
Web Development CAP426 HW3
Part-A
1. Write down the name of validation control with explanation for following:
a. Which control is required when a value is required for an input on the web
page
Ans :
b. Which control is required when we want to match input values with some
constants
Ans:
RangeValidator Server Control :-The RangeValidator Server Control makes sure that
the end user value or selection provided is between a specified ranges. Below given
example should give you clear picture .
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="Value must be between 20 and 30"
ControlToValidate="RangeTextbox"
Type="Integer" MinimumValue="20" MaximumValue="30" >
</asp:RangeValidator>
<asp:TextBox ID="RangeTextbox" runat="server"></asp:TextBox>
<asp:Button ID="CheckRange" runat="CheckRange" Text="Button" />
c. Which control is required when we want to check value from the range of
values
Ans :
RangeValidator Server Control :-The RangeValidator Server Control makes sure that
the end user value or selection provided is between a specified ranges. Below given
example should give you clear picture .
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="Value must be between 20 and 30"
ControlToValidate="RangeTextbox"
Type="Integer" MinimumValue="20" MaximumValue="30" >
</asp:RangeValidator>
<asp:TextBox ID="RangeTextbox" runat="server"></asp:TextBox>
<asp:Button ID="CheckRange" runat="CheckRange" Text="Button" />
e. Which control is required to capture all the validation errors on the page
Web.Config
<configuration>
<system.web>
<sessionState timeout=”2” />
</system.web>
</configuration>
Ans:
LoginStatus:-Enables you to display either a log in or log out link, depending on a
user’s authentication status.
Part-B
4. List out the categories of controls available in ASP.NET with brief description.
Ans :
The ASP.Net framework contains over 70 controls. These controls can be
divided into 7 groups:
2) Validation Controls: The validation controls enable you to validate form data
before you submit the data to the server. For example, you can use a
RequiredFieldValidator control to check whether a user entered a value for a
required input field.
3) Rich Controls: The Rich controls enable you to render things such as
calendars, file upload buttons, rotating banner advertisements and multi-step
wizards.
4) Data Controls: The data controls enable you to work with data such as
database data. For example, you can use these controls to submit new records
to a database table or display a list of database records.
6) Login Controls: The login controls enable you to display login, change
password, and registration forms.
7) HTML Controls: The HTML controls enable you to convert any HTML tag into
a server-side control.
5. How you will recover the password using password Recover Control? Give an
example.
Ans :
<system.web>
<authentication mode="Forms" >
<forms loginUrl="UserLogin.aspx" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
6. Create a web form for various objects (like session, application, Request,
Response, cookies etc.) used in one web form.
Ans:
Code of page one:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
}
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;