Sunday, March 23, 2008
ASP dotnet faqs
Difference between ASP and ASP.NET ?
ASP :
1)It works based on scripting languages like JavaScript,VBScript which are interpreter-based languages so execution will be slow.
2)It does't support Object Oriented Programming.
3)Supports only Inline Coding where Design and BusinessLogic will be written in a single page.
4)For DataBase Accessing it uses ADO, which does't support pure disconnected architecture and XML Integration.
5)Requires manual coding for validations,login etc.
6)Supports only inprocess session.
7)Supports only output caching.
8)No built-in security, u need to provide coding.
9)It is not possible to create Setup for App.
10)Does't support business to business communication.
ASP.NET :
1)It works based on .Net Languages like VB.NET,C#.NET which are compiler-based so execution will be fast.
2)It supports Object Oriented Programming.
3)Supports CodeBehind Technique where Design and BusinessLogic will be written in seperate files.
4)It uses ADO.NET
5)Provides various controls like Validation,Navigation,Logincontrols etc.
6)Supports OutProcess Session,CookieLess Session and Session Optimization.
7)Supports 3 types of caching
* Output Caching
* Fragment Caching
* Data Caching
8)Provides built-in security as
* Windows Authentication
* Forms Authentication
* PassPort Authentication
9)We can easily create Setup for App.
10)Supports business to business communication by WebServices.
Page.IsPostBack Property
The Page_Load subroutine runs EVERY time the page is loaded. If you want to execute the code in the Page_Load subroutine only the FIRST time the page is loaded, you can use the Page.IsPostBack property. If the Page.IsPostBack property is false, the page is loaded for the first time, if it is true, the page is posted back to the server (i.e. when a button click on a form)
what is ViewState ?
When a form is submitted in classic ASP, all form values are cleared.
Suppose you have submitted a form with a lot of information and the server comes back with an error.
You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again!
The site did not maintain your ViewState.
When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come?
This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the page when submitted to the server.
The status is defined through a hidden field placed on each page.
Describe the role of 'inetinfo.exe' , 'aspnet_isapi.dll' and 'aspnet_wp.exe' ?
Ans :'inetinfo.exe' is theMicrosoft IIS server running, handling ASP.NET requests among other things.
When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI(Internet Service Application Programming Interface) filter 'aspnet_isapi.dll' takes care of it by passing the request tothe actual worker process 'aspnet_wp.exe'.
what is ASP.NET ?
ASP.Net is Microsoft’s latest Web development platform
that provides you all the class libraries necessary to develop Enterprise class Web applications.
It is definitely the next-generation ASP, with a total shift in the way you do web development compared to ASP.
Initially called as ASP+, Microsoft further renamed it to ASP.Net.
Define Personalization ?
ASP.NET 2.0 provides developers with a set of controls called web parts.
For creating websites that enable end users modify the content, appearance and behavior of the website from a browser.
With these tools users can select and receive only those content which interest them.
The modifications can be applied to all users of a site or restricted to individual users.
The settings made by the user can be saved and recalled to the browser when the user starts a session with the application.
This implies that developer can empower his user with capabilities that do not require the intervention of the developer or the administrator.
This feature is referred to as personalization.Difference between Postback and Callback? The difference between a callback and postback is that, as with a postback, a callback does not refresh the currently viewed page (i.e. does not redraw the page). You can think of it as a quick trip back to get some data etc. For example if there were two drop down boxes, the second dependant on the value of the first, when a user selects a value of a the first, rather then posting the whole page, doing some server side calculations and returning a new whole page to the client, a callback can enable you to only go fetch the required data. Obviously from this, View State is not updated with a callback (it's the same instance of the page just updated!!!). Differences between Datagrid, Datalist and Repeater. Datagrid has built in paging, sorting and editing capabilities which are not there with the other two controls. So if you want users to sort / page / edit data, datagrid is the natural choice. DataList and repeater have better performance than datagrid. So if performance is a major concern, for example, a site with large number of concurrent visitors, then you could think of datalist or repeater. Repeater is the most customizable. It allows you to create structures like nested lists, for example. A Datagrid row displays one record from the data source, while a datalist row can display more than one records (set by RepeatColumns property). Datagrid and Datalist are derived from WebControl while Repeater is not, and so does not have the stylistic properties of web controls. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Explaination:In ASP .NET basically there are three kinds of the Data Presentation Controls.
GridView (or DataGrid)
DataList
RepeaterWhen we talk about usage of one Data Presentation Controls then many of us get confused about choosing one. When you need to use one of the data Presentation Control then You have to see what kind of behavior you need in your Data Display.
Do you want to show Data in many Pages or in one page?
Do you have to Display more than one column in a Row ?
Do you want to have a Row repeating Possibility?
Will users be able to update, Insert and delete the Data? We are going provide a list of different abilities of Repeater Control, Datalist Control and GridView Control. Features of a GridView •Displays data as a table •Control over –Alternate item –Header –Footer –Colors, font, borders, etc. –Paging •Updateable •Item as row Features of Repeater •List format •No default output •More control •More complexity •Item as row •Not updateable Features of DataList •Directional rendering •Good for columns •Item as cell •Alternate item •Updateable I guess now it might be easier for you to decide. ------------------------------------------------------------------------------------------------------- The Difference between GET and POST
When the user enters information in a form and clicks Submit , there are two ways the information can be sent from the browser to the server: in the URL, or within the body of the HTTP request.
The GET method, which was used in the example earlier, appends name/value pairs to the URL. Unfortunately, the length of a URL is limited, so this method only works if there are only a few parameters. The URL could be truncated if the form uses a large number of parameters, or if the parameters contain large amounts of data. Also, parameters passed on the URL are visible in the address field of the browsernot the best place for a password to be displayed.
The alternative to the GET method is the POST method. This method packages the name/value pairs inside the body of the HTTP request, which makes for a cleaner URL and imposes no size limitations on the forms output. It is also more secure.
ASP makes it simple to retrieve name/value pairs. If the forms output is passed after the question mark (?) on the URL, as occurs when using the GET request method, the parameters can be retrieved using the Request.QueryString collection. Likewise, if the form is sent using the POST method, the forms output is parsed into the Request.Form collection. These collections let you address the form and URL parameters by name. For example, the value of the form variable User can be passed into a VBScript variable with one line of script:<% UserName = Request.Form("User") %>
You dont need to specify the collection ( Form or QueryString ) in which you expect to find the User parameter. The following is an equally valid method of searching for the User parameter:<% UserName = Request("User") %>
In the absence of a specific collection, the Request object will search all of its collections for a matching parameter. This is meant to be a programming convenience. However, the ASP Request object also contains collections for ServerVariables and ClientCertificates , which contain sensitive server and user authentication information. To avoid the possibility of spoofed values, which are values entered by the user in the URL, it is highly recommended that you explicitly use the collection name when searching for parameters from these collections.
The following script combines a form and an action (the script that processes the form) into a single page. By posting the form data back to the same ASP page that displays the form, server-side script can process the output of the form. This is perfectly valid, and for simple script is often more convenient than posting to a second ASP page.<%@ LANGUAGE="VBScript" %>
<% If Request.Form("User") = "" Then %>
Please enter your Name:
Your name:
Your password:
<% Else 'User verification and logon code goes here %>
Welcome <%= Request.Form("User") %>!
<% End If %>
Note If you use a separate ASP file to handle the processing of a form, the Request.Form collection will be emptied when you redirect to the new page. In order to retain the form values, you must copy them to the Session object from which they can be accessed on subsequent pages.
Although the sample authentication form shown here works, theres a good reason why you would not want to use it in practice. Logon information is sensitive and should be subject to rigorous protection from prying eyes. Although you can use the POST method to contain the users password within the body of the HTTP response, it is still possible to intercept and read it.
For mission-critical applications, IIS 5.0 provides both secure authentication with integrated Windows authentication and Client Certificates, as well as data encryption with Secure Sockets Layer (SSL). For more information about authentication and encryption, see Security in this book.
Labels:
ASP.NET 2.0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment