Solved

ASP.Net - Help translating code in Pade_Load event

Posted on 2013-05-22
5
407 Views
Last Modified: 2013-05-22
Good Day Experts!

I am back on my journey to learning ASP.Net.  Currently, I am a VB.Net programmer.
I have attached a text file with code that is in the Page_Load event for the Login.aspx of the website.  

Can you help and translate what is happening in the code?  Also, "If Not Page.IsPostBack Then"...will it ever be Page.IsPostBack and not run the code? Also, "If Not Request.Cookies("myCookie") Is Nothing Then"...will the cookies ever not be nohting?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39187932
I have attached a text file with code...
What file?  : )

Then"...will it ever be Page.IsPostBack and not run the code?
Yes. The first time a page is requested is not a post back. Clicking a button or interacting with some other control on the page (typically) triggers a post back.

Also, "If Not Request.Cookies("myCookie") Is Nothing Then"...will the cookies ever not be nohting?
Sure.
0
 

Author Comment

by:Jimbo99999
ID: 39187951
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39187979
"If Not Page.IsPostBack" is checking as to whether or not the page is being initially requested (e.g. a user types the URL into the browser's address bar). If this is the initial request of the page, then the session is cleared (just in case an existing session is still in memory, I presume). Then you are checking to see if the browser sent a cookie named "myCookie". If it did, then you extract the cookie from the request object. From this cookie you are extracting the values of the "ITSusername", "ITSP", "AMARKN" (commented out), and "ITSR" fields, and using them to set up the states of various controls (e.g. text boxes and check boxes). Finally, you are checking a code-behind field named "ModError" for any text. If it has text, then its text is placed into a label on the page.
0
 

Author Comment

by:Jimbo99999
ID: 39188126
Excellent, thanks for the explanation.  My next step of working through the code I put a breakpoint on the first line behind the login button.  After entering my username and password and I click the Login button...to my surprise the first line of code that is executed is in the Page_Load event of the Login.aspx!  So, once I am in the website I hit the Logout button and same thing...to my surprise the first line of code that is executed is in the Page_Load event of the Login.aspx!  I can't figure out why it happens and where in the code it tells it to go back to the Page_Load event of the Login.aspx page.

Do you have any thoughts that might help me understand?

Thanks,
jimbo99999
0
 

Author Closing Comment

by:Jimbo99999
ID: 39188283
Excellent...thanks for the help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question