Professional Documents
Culture Documents
A Guide to .net
Introduction to .NET Framework
· ASP.NET.
· Windows Forms.
· ADO.NET.
With the .Net Framework you can make your codes written in
fewer lines and other favourable features such as easy web
settings, easy deployment of applications, easy compilation
procedures, easy Web configuration makes the .NET Framework a
great platform to work with. In an overall scenario, the developers
will be able to concentrate more on Web controls and spend an
efficient time in application design and implementation and to
have an effective control over the flow of the application
sequence.
Another great feature that any developer can take note of is the
feature of .NET Framework taking into cognisance all the Web
controls, server-side blocks of codes and Web forms and getting
3
With the help of an XML based web.config file you can carry out
the web settings which is nothing but configuring the .NET
applications for successful running. The XML based web.config file
can be modified through a program and when any such
modification is done, the system recognises the change and
registers it immediately that makes configuration of .NET
applications easy and quick.
.NET Assemblies - I
4. Presentation
5. Business Logic
6. Database
9
on the data server without having to make any changes within the
code of your business logics.
.NET Assemblies - II
4. Increased performance.
5. Better code management and encapsulation.
6. Introduces the n-tier concepts and business logic.
This part of the article is going to be the last of the series. In the
last part I introduced you to what the .NET Assemblies are and for
what reasons are they used? You also were informed about the
advantages of using the .NET Assemblies as compared to the
other scripting techniques that we have available in the ASP .NET.
Imports System
Namespace HRM.Display
Public Class DisplayConsole
End Class
End Namespace
Now for the process of converting this file into a compiled DLL
file, we require to make a batch file. Again open the Notepad and
add the following to it. Save the following file by name
"MakeComponent.bat"
set indir=c:\inetpub\wwwroot\hrmDisplay.vb
set outdir=c:\inetpub\wwwroot\bin\hrmDisplay.dll
set assemblies=System.dll
vbc /t:library /out:%outdir% %indir% /r:%assemblies%
<configuration>
<system.web>
<sessionState timeout="10" />
<compilation>
<assemblies>
<add assembly="hrmDisplay" />
14
</assemblies>
</compilation>
</system.web>
</configuration>
Save this file as "web.config". The reason that we made the bin
directory and then placed the DLL file within it was that the
web.config would always search for the file in the bin directory,
not only this assembly, but other user defined and third party
assemblies also require there references to be added into the
web.config.
Now we are ready to use our component within our ASP .NET
page. Open up Notepad or any other editor and add the
following code into the file and save it as "Test.aspx".
Response.Write (objComponent.Welcome())
<br>
Response.Write (objComponent.Output("This is my message!"))
End Sub
</Script>
Though you can apply multiple server controls in your web form,
ASP.NET allows you to create new controls according to your
15
ASP.NET User Controls for a web form. For example, you can
create a user control using C# and another user control using
VB.NET and use both the ASP.NET User Controls on the same web
form.
Web pages in ASP.Net are called ASP.NET Web Forms which have
certain server controls such as text, dropdown list, checkboxes,
and buttons. An ASP.NET Web Form looks similar to the web forms
in HTML. The only difference is that in ASP.NET, the Web Forms
runs at the server side and in HTML the web forms runs at the
client side. Apart from this difference an ASP.NET Web Form has
more features than an ordinary HTML web form such as:
After you create a web form, you should make sure that
mandatory fields of the form elements such as login name and
password are not left blank; data inserted is correct and is within
the specified range. Validation is the method of scrutinizing that
the user has entered the correct values in input fields. In HTML
you can perform validation either by checking the values at client-
side or after submitting the form at the server-side. But these
methods in HTML take lots of time to create and maintain the
code. Moreover, if the user has disabled JavaScript then he or she
may not receive the message regarding the error.
This reduces the developer time from writing JavaScript for each
type of validation. Moreover, through ASP.NET Validation Controls
if any invalid data is entered the browser itself detects the error
on the client side and displays the error without requesting the
server. This is another advantage because it reduces the server
load.
If the control’s value does not validate to what you have specified
in the validation control tag, the web form displays an error
message. Moreover, you can customize the format of the error
message by using the control properties such as BackColor,
BorderStyle, and BorderWidth. In addition, you can use Cascading
Style Sheet (CSS) to format an error message.
ASP.NET Web Server Controls are controls that run at the web
server. All ASP.NET Web Server Controls can be identified by their
attribute ‘runat=”server”’. ASP.NET Web Server Controls are
similar to HTML controls. The only difference is that HTML controls
run at the client-side and the developers have to write the code
for each type of browsers. The ASP.NET Web Server Controls run
at the server-side and automatically adapt to the type of browser
that request it.
All web controls are obtained from a common base class. This
ensures that the object model remains consistent across various
controls. For example, in order to move the cursor consistently
across a form you can specify the Web control TabIndex property.
This is very difficult while using normal HTML. You can also disable
a particular web control by exposing the Enabled property. This
process is also difficult in HTML and ASP.
The controls listed in the List controls category are dropdown list
control, repeater control, datalist control, and datagrid control.
These controls use the concept of data binding. The controls listed
in the Rich controls category include calendar control and
adrotator control. These controls are specifically being employed
for complex tasks.
• White Pages
• Yellow Pages
• Green Pages
Apart from using the web services from UDDI, you can also search
a particular web service in UDDI. In addition, you can search for
companies’ information that posted web services. In certain
times, you might know the names of the companies that offer
web services but you may not be aware of the web services that
they offer. The WS Inspection is a specification in UDDI that allows
you to search for a collection of web services that are located in a
particular company name. You can evaluate these web services
according to your requirements.
STORE:
DataSet ds = GetDataSet(whatever parameters);
Session["mydataset")=ds;
RETRIEVE:
DataSet ds = (DataSet)Session["mydataset"];
Storage location
Performance
Robustness
Caveats
StateServer
SQLServer
Q: Why does the SessionID remain the same after the Session
times out or abandoned?
A:Even though the session state expires after the indicated
timeout period, the session ID lasts as long as the browser
session. What this implies is that the same session ID can
represent multiple sessions over time where the instance of the
browser remain the same.
27
This can be done if you call your web service through redirect.