ASP.NET Server side

Discussion in 'ASP.NET' started by MinalS, Jul 13, 2015.

  1. There are various built in objects in ASP.NET. They are as listed below:
    1. Application
    2. Session
    3. Request
    4. Response
    5. User
    6. HttpContext
    7. Cache
    8. Trace

    Server object



    The server object is an instance of System.Web.HttpServerUtility class. It provides reference to the HttpUtilityServer class. The server object provides access to the properties and methods of the web server.

    Properties of server object
    1. ScriptTimeout: The request timout in seconds for the web server can be accessed or assigned.
    2. MachineName: It is the name of the server machine.
    Methods of server object
    1. ClearError(): The last error occurred on the server is cleared.
    2. CreateObject(String): The server instance of the COM object is created.
    3. Execute(String): The handler for the specified virtual path in the current request is executed.
    4. GetLastError: It returns the previous exception
    5. Equals(Object): It checks whether the specified Object and the current Object are equal.
    6. GetType: The Type of the current instance is retrieved.
    7. HtmlDecode: The Html string is converted into ordinary string.
    8. HtmlEncode: The ordinary sting is modified into string with HTML characters.
    9. Transfer(String): The current execution is terminated. The execution of new page through the specified URL path is done.
    10. MapPath: The physical path of the specified virtual file path is returned.
    11. Transfer: The execution is transferred to another web page in the application
    12. UrlEncodeToken: It is similar to the UrlEncode.
    13. UrlDecodeToken: It is similar to UrlDecode.

    Request object



    The Request object has the reference to an object of HttpRequest class. The object helps the applications access the information sent by the client in a web request. The properties make the page load into the browser.

    Properties of Request object
    1. ApplicationPath: The application root path of ASP.NET is returned on the server.
    2. AcceptTypes: The array of client supported MIME accept types is provided.
    3. ContentCoding: The character set of the body is assigned or assigned.
    4. Browser: It gets or sets the information of the clients browser capabilities.
    5. ContentType: The MIME content type of the incoming requests is accessed or assigned.
    6. ContentEncoding: The character set of the body can be accessed or assigned.
    7. FilePath: The virtual path of the current request is accessed.
    8. Cookies: A collection of cookies sent by the client is accessed.
    9. Headers: The collection of HTTP headers is accessed.
    10. Form: The collection of form variables is accessed.
    11. HttpMethod: The HTTP data transfer method is accessed by the client.
    12. IsSecureConnection: The value showing the HTTP connection used the secure sockets.
    13. InputStream: The contents of the incoming HTTP request are retrieved.
    14. RequestType: The HTTP data transfer method is accessed or assigned.
    15. QueryString: The collection of the query string variables is accessed.
    16. RawUrl: The URL of the current request is retrieved.
    17. ServerVariables: The collection of server variables is accessed.
    18. UserAgent: The agent string of the current browser is accessed.
    19. UserLanguages: The string array of the client preferred language is retrieved.
    20. UserHostAddress: The IP host address of the remote client is accessed.
    Methods of Request object
    1. BinaryRead: The binary read operation specifies the number of bytes from the input stream.
    2. GetType: The Type of the current instance is accessed.
    3. Equals(Object): The specific object is equal to the current object.
    4. MapPath(String): The virtual path is mapped to the physical path.
    5. MapImageCoordinates: The incoming field form parameter is mapped to the corresponding co – ordinate values.
    6. ToString: The string representing the current object is returned.
    7. SaveAs: The HTTP request is saved.
    8. ValidateInput: The collections accessed using cookies, Form, QueryString properties are accessed.

    Response object



    The Response object states the response from the server to the client. It is instance of Web.HttpResponse class. The server side objects have object oriented methods for rendering. Hence, the response objects are not much of importance.

    The HttpResponse object provides functions like cookie and Redirect() method.

    Properties of Response object
    1. BufferOutput: It states whether to buffer the output or send it on page completion.
    2. Buffer: The value showing the buffer to output or send the response when the processing is finished.
    3. Charset: The HTTP character set of the output stream is accessed or assigned.
    4. Cookies: The response cookie collection is accessed.
    5. ContentType: The HTTP MIME type of output stream is accessed.
    6. Expires: The number of minutes before the page is cached before the browser expires.
    7. Headers: The collection of response headers is retrieved.
    8. IsClientConnected: States whether the client is connected to the system.
    9. OutputStream: The binary output of the outgoing HTTP content body is enabled.
    10. StatusCode: The HTTP status code for the output generated by the client.
    11. StatusDescription: The HTTP status of the string of the output generated by the client.
    Methods of Response object
    1. AppendCookie: It adds an HTTP cookie to the cookie collection.
    2. AddHeader: The HTTP header is added to the output stream.
    3. AppendToLog: The custom log information to the IIS log file.
    4. Close: The socket connection is closed to the client.
    5. ClearContent: The content output from the buffer stream is cleared.
    6. End: The buffered output is sent to the client, page execution is stopped, EndRequest event is raised.
    7. Flush: The recently buffered output are sent to the client.
    8. GetType: The Type of the current instance is returned.
    9. Redirect(String): A request to the new URL is redirected and a new URL is specified.
    10. SetCookie: The existing cookie is updated in the collection.
    11. TransmitFile(string): The specified file is directly written to HTTP response output stream.
    12. Write(Char): The character of HTTP response stream is written.
    13. Write(String): A string is written to HTTP response output stream.
    14. WriteFile(String): The contents of the specified file is written directly to the HTTP response output stream.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice