Monday, March 01, 2010

ASP.NET page lifecycle events

Events that raise while execution of page in ASP.NET

If(IsPostBack)

  1. Begin PreInit
  2. End PreInit
  3. Begin Init
  4. End Init
  5. Begin InitComplete
  6. End InitComplete
  7. Begin LoadState
  8. End LoadState
  9. Begin ProcessPostData
  10. End ProcessPostData
  11. Begin PreLoad
  12. End PreLoad
  13. Begin Load
  14. End Load
  15. Begin ProcessPostData (Again)
  16. End ProcessPostData (Again)
  17. Begin Raise ChangedEvents
  18. End Raise ChangedEvents
  19. Begin Raise PostBackEvent
  20. End Raise PostBackEvent
  21. Begin LoadComplete
  22. End LoadComplete
  23. Begin PreRender
  24. End PreRender
  25. Begin PreRenderComplete
  26. End PreRenderComplete
  27. Begin SaveState
  28. End SaveState
  29. Begin SaveStateComplete
  30. End SaveStateComplete
  31. Begin Render
  32. End Render

If (!IsPostBack)

  1. Begin PreInit
  2. End PreInit
  3. Begin Init
  4. End Init
  5. Begin InitComplete
  6. End InitComplete
  7. Begin PreLoad
  8. End PreLoad
  9. Begin Load
  10. End Load
  11. Begin LoadComplete
  12. End LoadComplete
  13. Begin PreRender
  14. End PreRender
  15. Begin PreRenderComplete
  16. End PreRenderComplete
  17. Begin SaveState
  18. End SaveState
  19. Begin SaveStateComplete
  20. End SaveStateComplete
  21. Begin Render
  22. End Render

Check this URL to understand complete ASP.NET Page Object Model

How to : Windows 2003 Server does not stream FLV videos

When Flash Player movie files that stream external FLV files (Flash videos) are placed on a Microsoft Windows 2003 server and then viewed in a browser, the SWF file plays correctly, but the FLV video does not stream. These files work correctly if tested on other operating systems. The issue affects all FLV files played via Windows 2003 server

SOLUTION
  1. On the Windows 2003 server, open the Internet Information Services Manager.
  2. Expand the Local Computer Server.
  3. Right-click the local computer server and select Properties.
  4. Select the MIME Types tab.
  5. Click New and enter the following information:
    • Associated Extension box: .FLV
    • MIME Type box:flv-application/octet-stream
  6. Click OK.
  7. Restart the World Wide Web Publishing service.

Hope this helps.

Thursday, February 25, 2010

SRT – THE KING

Sachin Tendulkar collared South Africa's attack on his way to a historic 200*

114673.3

Tendulkar's finest ODI performances

114677

Sachin Tendulkar reaches 200 in the last over, 2nd ODI, Gwalior, February 24, 2010

A selection of tributes on Sachin Tendulkar's double-century

The ultimate ODI innings

114667

Breaking the barrier

Highest Individual ODI Scores

I'd like to bat another full 50 overs - Tendulkar

Get ASP.NET Menu work on Chrome, Safari and Opera

I have done some research on this, i found couple of interesting solutions. Actually the are cracks to get Menu working

Solution 1:

// For Cross Browser Compatibility (Safari/Chrome) 
       if (Request.UserAgent.IndexOf("AppleWebKit") > 0) 
       { 
           Request.Browser.Adapters.Clear(); 
       }


I have added this code in master page. I Worked when there is no master page. But when there is a master page its not working for the first time so found below code which works with master page.



Solution 2:



protected override void AddedControl(Control control, int index) 
  { 
      if (Request.ServerVariables["http_user_agent"].IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1) 
      { 
          this.Page.ClientTarget = "uplevel"; 
      } 
      base.AddedControl(control, index); 
  }


The reason i added it in the AddedControl method was so that i didn't have to use a basepage or parent class that every single aspx file had to inherit. And its the only method that i found to run before the Page_PreInit. Hope it works for you too!

Thursday, February 18, 2010

Hypertext Transfer Protocol (HTTP) Status Code Registry

HTTP Status codes are returned by the server to the client software to determine the outcome of a request, the codes below are the HTTP /1.1 codes

HTTP CODES - 100-101

100 - Continue
Tells the client that the first part of the request has been received and that it should continue with the rest of the request or ignore if the request has been fulfilled.

101 - Switching Protocols
Tells the client that the server will switch protocols to that specified in the Upgrade message header field during the current connection.

HTTP CODES 200-206

200 - OK
The request sent by the client was successful.

201 - Created
The request was successful and a new resource was created.

202 - Accepted
The request has been accepted for processing, but has not yet been processed.

203 - Non-Authoritative Information
The returned meta information in the entity-header is not the definitive set as available from the origin server.

204 - No Content
The request was successful but does not require the return of an entity-body.

205 - Reset Content
The request was successful but the User-Agent should reset the document view that caused the request.

206 - Partial Content
The partial GET request has been successful.

HTTP CODES 300-307

300 - Multiple Choices
The requested resource has multiple possibilities, each with different locations.

301 - Moved Permanently
The resource has permanently moved to a different URI.

302 - Found
The requested resource has been found under a different URI but the client should continue to use the original URI.

303 - See Other
The requested response is at a different URI and should be accessed using a GET command at the given URI.

304 - Not Modified
The resource has not been modified since the last request.

305 - Use Proxy
The requested resource can only be accessed through the proxy specified in the location field.

306 - No Longer Used
Reserved for future use.

307 - Temporary Redirect
The resource has temporarily been moved to a different URI. The client should use the original URI to access the resource in future as the URI may change.

 

HTTP CODES 400-417

400 - Bad Request
The syntax of the request was not understood by the server.

401 - Not Authorised
The request needs user authentication

402 - Payment Required
Reserved for future use.

403 - Forbidden
The server has refused to fulfill the request.

404 - Not Found
The document/file requested by the client was not found.

405 - Method Not Allowed
The method specified in the Request-Line is not allowed for the specified resource.

406 - Not Acceptable
The resource requested is only capable of generating response entities which have content characteristics not specified in the accept headers sent in the request.

407 - Proxy Authentication Required
The request first requires authentication with the proxy.

408 - Request Timeout
The client failed to sent a request in the time allowed by the server.

409 - Conflict
The request was unsuccessful due to a conflict in the state of the resource.

410 - Gone
The resource requested is no longer available and no forwarding address is available.

411 - Length Required
The server will not accept the request without a valid Content-Length header field.

412 - Precondition Failed
A precondition specified in one or more Request-Header fields returned false.

413 - Request Entity Too Large
The request was unsuccessful because the request entity is larger than the server will allow.

414 - Request URI Too Long
The request was unsuccessful because the URI specified is longer than the server is willing to process.

415 - Unsupported Media Type
The request was unsuccessful because the entity of the request is in a format not supported by the requested resource for the method requested.

416 - Requested Range Not Satisfiable
The request included a Range request-header field, and not any of the range-specifier values in this field overlap the current extent of the selected resource, and also the request did not include an If-Range request-header field.

417 - Expectation Failed
The expectation given in the Expect request-header could not be fulfilled by the server.

 

HTTP CODES 500-505

500 - Internal Server Error
The request was unsuccessful due to an unexpected condition encountered by the server.

501 - Not Implemented
The request was unsuccessful because the server can not support the functionality needed to fulfill the request.

502 - Bad Gateway
The server received an invalid response from the upstream server while trying to fulfill the request.

503 - Service Unavailable
The request was unsuccessful to the server being down or overloaded.

504 - Gateway Timeout
The upstream server failed to send a request in the time allowed by the server.

505 - HTTP Version Not Supported
The server does not support or is not allowing the HTTP protocol version specified in the request.

Visit the World Wide Web Consortium or List of Status codes from Wiki to find out more definitions.