Sie sind auf Seite 1von 6

ASSIGNMENT INT-402 MODERN WEB PROGRAMMING

SUBMITTED BY: Nikhil Seth 10803307


1. How can you differentiate between EnableViewState and

ViewStateMode properties?

2. Answer following in context to master pages: I. What are the 2 important parts of a master page?

The following are the 2 important parts of a master page 1. The Master Page itself 2. One or more Content Pages
II.

What are the 3 levels at which content pages can be attached to Master Page? The 3 levels at which content pages can be attached to Master Page are as follows, 1. At the page level - You can use a page directive in each content page to bind it to a master page. 2. At the application level - By making a setting in the pages element of the application's configuration file (Web.config), you can specify that all ASP.NET pages (.aspx files) in the application automatically bind to a master page. 2. At the folder level - This strategy is like binding at the application level, except that you make the setting in a Web.config file in one folder only. The master-page bindings then apply to the ASP.NET pages in that folder.

III.

Can you dynamically assign a Master Page? Yes , sample code to assing master page dynamically.

void Page_PreInit(Object sender, EventArgs e) { this.MasterPageFile = "~/MasterPage.master"; }

IV.

Can you access controls on the Master Page without using FindControl() method? Yes, by casting the Master to your MasterPage as shown in the below code sample. protected void Page_Load(object sender, EventArgs e) { MyMasterPage MMP = this.Master; MMP.MyTextBox.Text = "Text Box Found"; }

3. Is it possible to send a webform's QueryString, ViewState, and event procedure information to another webform? .

4. What is the difference between DataReader and DataAdapter?

DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type). Reader is best fit to show the Data (where no need to work on data) Datareader is connected mode. and read and forward-only Data. DataReader directly access the table and it is only used for reading the records from it whereas dataadapter, used to maintain connection, is always used with dataset as dataset is of disconnected-architecture in nature. DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data. DataAdapter is Bridge between Database and DataSet.

5. Answer following in context to cookies: (i) What is the difference between Session Cookies and Persistent Cookies? Cookies are either stored in memory (session cookie) or placed on your hard disk (persistence cookies) A persistent cookie can keep information in the user's browser until deleted. If a person has a login and password, this can be set as a cookie in their browser so they do not have to re-login to your website every time they visit. You can store almost anything in a browser cookie. The trouble is that a user can block cookies or delete them at any time.

If, for example, your website's shopping cart utilized cookies, and a person had their browser set to block them, then they could not shop at your website. Sessions are not reliant on the user allowing a cookie. They work instead like a token allowing access and passing information while the user has their browser open. The problem with sessions is that when you close your browser you also lose the session. So, if you had a site requiring a login, this couldn't be saved as a session like it could as a cookie, and the user would be forced to relogin every time they visit. (ii)What are Persistent Cookies used for? Persistent cookies help websites remember your information and settings when you visit them in the future. This result in faster and more convenient access since, for example, you don't have to login again. Besides authentication, other website features made possible by persistent cookies include: language selection, theme selection, menu preferences, internal site bookmarks or favorites, among many others. On your first visit, the website is presented in default mode. During your visit, you select your preferences and these preferences are remembered, through the use of the persistent cookie, the next time you visit the site. For example, a website may offer its contents in different languages. On your first visit, you may choose to have the content delivered in French and the site may record that preference in a persistent cookie set on your browser. When you revisit that site it will use the cookie to ensure that the content is delivered in French. A persistent cookie enables a website to remember you on subsequent visits, speeding up or enhancing your experience of services or functions offered. For example, a website may offer its contents in different languages. On your first visit, you may choose to have the content delivered in French and the site may record that preference in a persistent cookie

set on your browser. When you revisit that site it will use the cookie to ensure that the content is delivered in French. For a demonstration of how a persistent cookie might be used. You can decide whether to allow your browser to accept these types of cookies by changing the settings. For more information, please go to the manage cookies section.

(iii)What is Cookie Dictionary? A cookie dictionary is a single cookie object that stores multiple pieces of information. You use the Values property to access and assign new values to the cookie dictionary. (iv)What are the disadvantages of Using Cookies? 1. Size limitations: Most browsers place a 4096-byte limit on the size of a cookie. 2. Users disable their browser or client device's ability to receive cookies, thereby limiting this functionality. 3. Cookies are subject to tampering. Users can manipulate cookies on their computer, which can potentially cause a security risk or cause the application that is dependent on the cookie to fail. 4. Users can delete a cookies.

Das könnte Ihnen auch gefallen