Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Built in Objects in ASP.NET

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5.34k
    Comment on it

    ASP stands for Active Server Pages. By using ASP built-in objects, we can get the information related to the web server, web pages in the web application etc. the built-in objects are categorized according to the information it contain.

    Following are the built-in objects in cakePHP

    •  Application
    • Request
    • Response
    • Server
    • Session

    1. Application-

    Application object is used to share information between all users of application. In application more then one user can use that method at a time, so there is lock and unlock method so that multiple users can not use a property at same time.

    Methods in Application object:-

    • Application.Contents.Remove- Used to delete an item from the application.
    • Application.Contents.RemoveAll- Used to delete all items from the application.
    • Application.Lock- Used so that unauthorized users can not make changes.
    • Application.Unlock- Allows unauthorized users to make changes.

    E.g of Application object:-

    <% 
    Application.Lock 
    Application("NumVisits") = Application("NumVisits") + 1 
    Application.Unlock 
    %>  
    
    This application page has been visited  
    <%= Application("NumVisits") %> times! 
    

     

    2. Request Objects-

    Used to get the data that was sent by the client browser to the server.

    Method in Request objects:-

    • Request.BinaryRead- Used to retrieve the data.
    • Request.Form- Reads data sent by POST.
    • Request.QueryString- Reads data sent by GET.

    E.g of Request object:-

     

    <%
    Response.Write "Welcome " & Server.HTMLEncode(Request.QueryString("name")) & "!"
    %>

     

    3. Response Object-

    Used to send information to the client.

    Methods in Response objects:-

    • Response.AddHeader- Used to set header
    • Response.AppendToLog- Used to add data at the end of the web page.
    • Response.BinaryWrite- Used to set information in the current HTTP output.
    • Response.Clear- Used to erase the output.
    • Response.End- Used to end the processing.

     

    E.g of Response object:-

    <%
    If Len(Request.QueryString("name")) > 0 Then
         Response.Cookies("name") = Request.QueryString("name") 
    End If
    
    Response.Write "Welcome " & Server.HTMLEncode(Response.Cookies("name")) & "!"
    %>

     

    4. Server Object-

    Methods and properties on the server are accessed by Server object. It also allows connection to the database.

    Methods in Server object:-

    • Server.CreateObject- Used to create an instance of server component.
    • Server.Execute- Used to execute .asp file.
    • Server.HtmlEncode- Encode html code into specific string.
    • Server.Transfer- Sends all current information to another .asp file for processing.
    • Server.URLEncode- Apply URL encoding rules.

     

    E.g of Server object:-

    <%
    Dim oAdoCon, oAdoRec, oAdoStm, oCdoCon, oCdoMsg, oSciDic, oSciFsm, oMswAdr
    
    Set oAdoCon = Server.CreateObject("ADODB.Connection")
    Set oAdoRec = Server.CreateObject("ADODB.Recordset")
    Set oAdoStm = Server.CreateObject("ADODB.Stream")
    Set oCdoCon = Server.CreateObject("CDO.Configuration")
    Set oCdoMsg = Server.CreateObject("CDO.Message")
    Set oSciDic = Server.CreateObject("Scripting.Dictionary")
    Set oSciFsm = Server.CreateObject("Scripting.FileSystemObject")
    Set oMswAdr = Server.CreateObject("MSWC.AdRotator")
    %>

     

    5. Session Object-

    Used to store information only needed for a particular visitor.

    Methods in Session object:-

    • Session.Abandon- Destroys session object and release it's resources.
    • Session.Contents.Remove- Deletes an item.
    • Session.Contents.RemoveAll- deletes all items.

    E.g of Session object:-

    <%
    If Len(Request.QueryString("name")) > 0 Then
         Session("name") = Request.QueryString("name") 
    End If
    
    Response.Write "Welcome " & Server.HTMLEncode(Session("name")) & "!"
    %>

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: