Learn Basic ASP in Urdu Hindi Free Tutorial
We Provide in this Lesson Learn Basic ASP in Urdu Hindi Free Tutorial for all students will get to know basic ASP. And create a basic website in ASP
ASP (Active Server Pages) is an old but powerful Microsoft program that runs inside the web server. ASP is a technology for executing scripts on a web server. An ASP file has the file extension ‘.asp’. ASP files are just like HTML that can edit, change, add content or customize any web page. It offers simplicity and speed and can access databases to return results to a browser for data submitted from HTML forms.
When an ASP file is requested in a browser, the server passes the request to the ASP engine which then reads the ASP file and executes the server scripts in it. ASP uses the VB Script scripting language.
ASP Procedures:
The ASP source code can contain procedures and functions for example:
<!DOCTYPE html>
<html>
<head>
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head>
<body>
<p>Result: <%call vbproc(3,4)%></p>
</body>
</html>
Conditional Statements:
Conditional statements are used to perform different actions for different decisions. There are four conditional statements in VBScript:
- If statement–runs a set of code under a true condition.
- If…Then…Else statement– select one of two sets of lines to execute.
- ..Then…ElseIf statement– select one of many sets of lines to execute.
- Select Case statement– select one of many sets of lines to execute.
Looping Statements:
Looping statements are used to run a similar block of code for a specific number of times. In VBScript there are four looping statements:
- ..Next statement – runs code a specified number of times.
- For ..Next statement – runs code for each element or item of an array or collection.
- ..Loop statement – loops while or until a condition is true.
- ..Wend statement – Do not use it – use the Do…Loop statement instead.
Cookies:
A cookie is often used to identify a user. It is a small file that the server embeds in a user’s computer. Every time a user accesses a webpage from the same browser, it sends the cookie that’s stored in his computer. With ASP, you can create and retrieve cookie values. The ‘Response.Cookies’ command is used to create cookies,for example:
- <%
Cookies(“firstname”)=”Alex”
Response.Cookies(“firstname”).Expires=#May 10,2012#
%>
The ‘Request.Cookies’ command is used to retrieve cookies, for instance, retrieving the value of the cookie entitled “firstname” and show it on the page:
- <%
fname=Request.Cookies(“firstname”)
write(“Firstname=” &fname)
%>
Output: Firstname=Alex
Session Object:
A session object saves information about or change settings for a user session. When you run any kind of application on a computer, make some modifications in it and then close it, this is what a Session is. The computer knows who you are; it knows when you open and close the application.
The Web server, however, does not know who you are or what you do, because the HTTP address does not maintain state. This problem is solved by the ASP creating cookies for each user. The cookie is sent to the user’s computer and then it stores information that identifies the user.This interface is known as the Session object. The Session object stores data about the client session or change the settings for the same.