Tag Cloud

CRM 2011 (161) CRM 4.0 (144) C# (116) JScript (109) Plugin (92) Registry (90) Techpedia (77) PyS60 (68) WScript (43) Plugin Message (31) Exploit (27) ShellCode (26) FAQ (22) JavaScript (21) Killer Codes (21) Hax (18) VB 6.0 (17) Commands (16) VBScript (16) Quotes (15) Turbo C++ (13) WMI (13) Security (11) 1337 (10) Tutorials (10) Asp.Net (9) Safe Boot (9) Python (8) Interview Questions (6) video (6) Ajax (5) VC++ (5) WebService (5) Workflow (5) Bat (4) Dorks (4) Sql Server (4) Aptitude (3) Picklist (3) Tweak (3) WCF (3) regex (3) Config (2) LINQ (2) PHP (2) Shell (2) Silverlight (2) TSql (2) flowchart (2) serialize (2) ASHX (1) CRM 4.0 Videos (1) Debug (1) FetchXml (1) GAC (1) General (1) Generics (1) HttpWebRequest (1) InputParameters (1) Lookup (1) Offline Plug-ins (1) OutputParameters (1) Plug-in Constructor (1) Protocol (1) RIA (1) Sharepoint (1) Walkthrough (1) Web.config (1) design patterns (1) generic (1) iframe (1) secure config (1) unsecure config (1) url (1)

Pages

Wednesday, November 16, 2011

How Http.Request and Http.Response Work in ASP.NET


Prerequisites (Getting Your Website Publicly Hosted): 


Step 1: Buy Domain name from a Domain Registrar like GoDaddy (costs about $8.00 for 1 yr). This connects the domain name that you purchase to a unique ip address - example http://myqol.com is connected to 96.31.43.8 

Step 2: Buy asp.net hosting package from hosting company like DiscountAsp (costs about $10 each month) - the hosting company needs to use Microsoft's IIS (Internet Information Server) on a Windows operating system - it cannot use Apache Server on a Linux operating system 

Step 3: Buy add-on for SQL Server database from DiscountAsp (costs $10 a month) - this step can be skipped if you have already bought an add-on database for another web site, and you only want to add some tables to that existing database. 

Step 4: Update nameservers in GoDaddy to point to DiscountAsp nameservers. DiscountAsp sends you in an email telling you the nameservers to use: for example, ns1.discountasp.net, ns2.discountasp.net, ns3.discountasp.net 

Step 5: Publish, Web Copy, or FTP your website from the folder it was in when you developed it in Visual Studio to the ftp folder on DiscountAsp. For example, ftp.myqol.com 



Intial Http.Request: 

1. You enter the domain name into your browser (this is known as the client machine) - ex. http://myqol.com 

2. Domain Name Server on internet translates the domain name (http://myqol.com) into the ip address (96.31.43.8) that you bought from GoDaddy. GoDaddy takes ip address (96.31.43.8) and passes the request to Name Servers on DiscountAsp: ns1.discountasp.net, ns2.discountasp.net, ns3.discountasp.net 

3. DiscountAsp NameServers do port forwarding to translate the ip address you bought from GoDaddy (96.31.43.8) to a unique local ip address on DiscountAsp (192.168.5.94) 

4. Local address (192.168.5.94) on DiscountAsp points to your website hosted in IIS and that connects you to the folder where you Published, Web Copy-ed, or FTP-ed your website 

5. The Http.Request for a page reaches IIS on the DiscountAsp server (this is known as the server machine - hence, that is why the architecture is referred to as being client-server). The TCP/IP connection on the server was in the "listening" state, but now the connection state is changed to being "established." IIS checks to see if you have the authority to access the page. 



Initial Http.Response: 

If you do have the authority, the web server executes the code behind instructions to construct a web page and sends it to the ip address of the computer that requested the page 

Three Possible Scenarios after Initial Http.Request: 

Scenario #1 Request: you hover your mouse over a field 

Scenario #1 Response: javascript on the page that was sent to your browser executes without returning to the server and displays a tool tip on the page very efficently. 

Scenario #2 Request: you click on a button that is contained within in a ajax panel. 

Scenario #2 Response: javascript on the page only sends the information in the ajax update panel to the server and the server does whatever your code behind tells it. This allows the server to return a response without doing a full postback and without returning everything on the page - this is more efficient than doing a full postback 

Scenario #3 Request: you click on a submit button for a form that is not contained in ajax panel. This sends all the info on the page to the server in Http.Request 

Scenario #3 Response: Full PostBack Occurs: 

1. The server executes your code-behind instructions to do whatever is needed. For example, the code-behind instructions may cause the server to execute instructions to send commands to SQL Server that will insert the information in the form into the database. Once all the commands in the code-behind are executed the server sends back a Http.Respone with any information updated that the code behind said to update - for example, labels on the web form may be modified to indicate the update was successful 

2. The Http.Request and Http.Response are now complete and the transaction is over until you initiate another one with the mouse or keyboard. 

3. When you navigate away from the website, the TCP/IP connection changes from being in the "established" state to being "closed."

No comments: