University Questions With Answer: B.SC - It/Cs Department of Rizvi College of Arts, Science and Commerce
University Questions With Answer: B.SC - It/Cs Department of Rizvi College of Arts, Science and Commerce
The XmlTextReader moves through your document from top to bottom, one node at a time. You
call the Read() method to move to the next node. This method returns true if there are more
nodes to read or false once it has read the final node. The current node is provided through the
properties of the XmlTextReader class, such as NodeType and Name.
A node is a designation that includes comments, whitespace, opening tags, closing tags, content,
and even
the XML declaration at the top of your file. To get a quick understanding of nodes, you can use
the XmlTextReader to run through your entire document from start to finish and display every
node it encounters.
Example:
string file = Path.Combine(Request.PhysicalApplicationPath,
@"App_Data\SuperProProductList.xml");
FileStreamfs = new FileStream(file, FileMode.Open);
XmlTextReader r = new XmlTextReader(fs);
// Use a StringWriter to build up a string of HTML that
// describes the information read from the XML document.
StringWriter writer = new StringWriter();
// Parse the file, and read each node.
while (r.Read())
{
// Skip whitespace.
if (r.NodeType == XmlNodeType.Whitespace) continue;
writer.Write("<b>Type:</b> ");
writer.Write(r.NodeType.ToString());
writer.Write("<br>");
// The name is available when reading the opening and closing tags
// for an element. It's not available when reading the inner content.
if (r.Name != "")
{
writer.Write("<b>Name:</b> ");
writer.Write(r.Name);
writer.Write("<br>");
}
// The value is when reading the inner content.
1. Windows Authentication
2. Forms Authentication
3. Passport Authentication
4. Custom Authentication
Windows-based authentication:
It causes the browser to display a login dialog box when the user attempts to access restricted
page.
It is supported by most browsers.
It is configured through the IIS management console.
It uses windows user accounts and directory rights to grant access to restricted pages.
Impersonation is the process of executing code in the context of another user identity. By default,
all ASP.NET code is executed using a fixed machine-specific account. To execute code using
another identity we can use the built-in impersonation capabilities of ASP.NET. We can use a
predefined user account or user's identity, if the user has already been authenticated using a
windows account.
These two scenario are fundamentally different. In the first one, impersonation defines a single,
specific account. In this case, no matter what user access the application, and no matter what
type of user-level security you use, the code will run under the account you've set. In the second
one, the user must be authenticated by IIS. The web-page code will then execute under the
identity of the appropriate user.
Implement Impersonation:
To impersonate the IIS authenticating user on every request for every page in an ASP.NET
application, we must include an <identity> tag in the Web.config file of this application and set
the impersonate attribute to true.
<identityimpersonate="true"/>
To impersonate a specific user for all the requests on all pages of an ASP.NET application, you
can specify the userName and password attributes in the <identity> tag of the Web.config file for
that application.
<identityimpersonate="true"userName="AccountNAME"password="Password"/>
----------------------------------------------------------------------------------------------------
Q5. Explain ASP.NET AJAX Control Toolkit.
----------------------------------------------------------------------------------------------------
Ajax Control Toolkit is an open source library for web development. The ASP.net Ajax Control
toolkit contains highly rich web development controls for creating responsive and interactive
AJAX enabled web applications.
ASP.Net Ajax Control Toolkit contains 40 + ready controls which is easy to use for fast
productivity.
controls are like AutoComplete, Color Picker, Calendar, Watermark, Modal Popup Extender,
Slideshow Extender and more of the useful controls.
The AJAX Control Toolkit contains more than 30 controls that enable you to easily create rich,
interactive web pages.
Browser Support:
It supports all new, updated and stable versions of Firefox, Chrome, Opera, Apple Safari and
internet Explorer > 8 Version.
Visual Studio Support:
It supports Visual studio version greater than 2010
System Requirements:
.Net Framework 4.0 or higher is required.
Visual Studio 2010 or higher with Editions enlisted in visual studio support.
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
Q8. Explain the Reading process from an XML Document with example.
----------------------------------------------------------------------------------------------------
Reading the XML document in your code is just as easy with the corresponding
XmlTextReaderclass.
There are mainly two methods for reading XML with C#: The XmlDocument class and
the XmlReader class. XmlDocument reads the entire XML content into memory and then
lets you navigate back and forward in it as you please, or even query the document
using the XPath technology.
The XmlReader is a faster and less memory-consuming alternative. It lets you run
through the XML content one element at a time, while allowing you to look at the value,
and then moves on to the next element. By doing so, it obviously consumes very little
memory because it only holds the current element, and because you have to manually
check the values, you will only get the relevant elements, making it very fast.
stringfile=Path.Combine(Request.PhysicalApplicationPath,
@"App_Data\SuperProProductList.xml");
FileStreamfs=newFileStream(file,FileMode.Open);XmlTextReaderr=ne
wXmlTextReader(fs);
//UseaStringWriter tobuildupa stringofHTMLthat
//describestheinformationreadfromtheXMLdocument.
StringWriterwriter=newStringWriter();
//Parsethefile,andreadeachnode.while(r.Red())
{
Authorization
Authorization is the process of allowing an authenticated user to access the resources by
checking whether the user has access rights to the system. Authorization helps you to control
access rights by granting or denying specific permissions to an authenticated user.
Example:
<authorization>
< allowusers="admin"/>
< denyusers="coder"/>
</authorization>
1. Windows Authentication
2. Forms Authentication
3. Passport Authentication
4. Custom Authentication
Windows-based authentication:
It causes the browser to display a login dialog box when the user attempts to access
restricted page.
It is supported by most browsers.
It is configured through the IIS management console.
It uses windows user accounts and directory rights to grant access to restricted pages.
Forms-based authentication:
Developer codes a login form that gets the user name and password.
The username and password entered by user are encrypted if the login page uses a secure
connection.
It doesn’t reply on windows user account.
Windows Live ID authentication:
It is centralized authentication service offered by Microsoft.
The advantage is that the user only has one maintain one username and password.
The ASP.NET applications resides in Internet Information Server (IIS). Any user's web
request goes directly to the IIS server and it provides the authentication process in a
Windows-based authentication model.
When you configure your ASP.NET application as windows authentication it will use
local windows user and groups to do authentication and authorization for your ASP.NET
pages.
In ‘web.config’ file set the authentication mode to ‘Windows’ as shown in the below
code snippets.
<authentication mode="Windows"/>
We also need to ensure that all users are denied except authorized users. The below code
snippet inside the authorization tag that all users are denied. ‘?’ indicates any
<authorization>
<deny users="?"/>
</authorization>
We also need to specify the authorization part. We need to insert the below snippet in the
‘web.config’ file .stating that only ‘Administrator’ users will have access to
<location path="Admin.aspx">
<system.web>
<authorization>
<allow roles="questpon-srize2\Administrator"/>
<deny users="*"/>
</authorization>
----------------------------------------------------------------------------------------------------
Q11. Explain AJAX with its Advantages and Disadvantages.
----------------------------------------------------------------------------------------------------
Ajax, which stands for Asynchronous JavaScript And XML, enables your client- side
web pages to exchange data with the server through asynchronous calls.
Probably the most popular feature driven by Ajax is the flicker-free page that enables you
to perform a postback to the server without refreshing the entire page.
Although a number of different Ajax frameworks are available for ASP.NET, the most
obvious one is Microsoft ASF.NETAJAX, because it comes fully integrated with
the.NET 4 Framework and Visual Web Developer 2010.
Advantages of AJAX
Reduce the traffic travels between the client and the server.
Response time is faster so increases performance and speed.
You can use JSON (JavaScript Object Notation) which is alternative to XML. JSON is
key value pair and works like an array.
Ready Open source JavaScript libraries available for use – JQuery, etc.
AJAX communicates over HTTP Protocol.
Disadvantages of AJAX
It can increase design and development time
More complex than building classic web application
Security is less in AJAX application as all files are downloaded at client side.
Search Engine like Google cannot index AJAX pages.
JavaScript disabled browsers cannot use the application.
Due to security constraints, you can only use it to access information from the host that
served the initial page. If you need to display information from another server, it is not
possible within the AJAX.
----------------------------------------------------------------------------------------------------
Q12. Give Brief information on Accordion control with appropriate properties.
----------------------------------------------------------------------------------------------------
The accordion is a graphical control element comprising a vertically stacked list of items, such as
labels or thumbnails. Each item can be "expanded" or "collapsed" to reveal the content
associated with that item. There can be zero expanded items, exactly one, or more than one item
expanded at a time, depending on the configuration.