Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager.
ASP.NET HandsOn 03smiertsc/2336itec/ASP.NET_HandsOn_03.pdfGetting Started with Visual Studio –...
Transcript of ASP.NET HandsOn 03smiertsc/2336itec/ASP.NET_HandsOn_03.pdfGetting Started with Visual Studio –...
ASP.NET Hands-OnLesson 03
By Susan L. Miertschin
Use a Text Editor?
Notepad – bare bones? Notepad – not really feasible with server-
side development in ASP.NET Visual Studio and its integrated
development environment that includes the SmartSense enabled text editor –much better – essential, really
Getting Started with Visual Studio – Our Development Environment Changes!
Open Visual StudioFile – New Project
Getting Started with Visual Studio – What Type of Project?
ASP.NET Web Application Project – You may name it: ASP.NET_HandsOn_03
Add a Web Form to the Project
Name the new Web From Recommendations.aspx
Also – your project starts from Default.aspx – where the Deitel textbook project named that page Options.aspx
Deitel’s ASP.NET Exercise on Session Tracking – Edit Default. aspx
In Design view, create the interface shown in Figure 25.20 (a) and (b) – more or lessHere is my version of it
Deitel’s ASP.NET Exercise on Session Tracking – RuntimeDefault. aspx
Note that when the interface is running the label with the links is not visible – provided you used the settings as indicated in the Deitel text in Figure 25.20
Write Code in the Code-Behind File of Default.aspx (or Options.aspx)
In Solution Explorer, click the icon to See All Files in order to see the code-behind filesThe code you need to write is in Figure 25.21 of the Deitel textbook
Use the Visual Studio Integrated Development Environment (IDE)
You should not type the code for the event procedures directly from the bookUse the IDE instead
Use the Visual Studio Integrated Development Environment (IDE)
The IDE creates the code structure for the event procedure
Here you type the code for the Page_Init event
This code adds data to the books HashTable
The HashTable will be created on the Web Server when the user interacts with the web application
The data from the HashTable is accessed by the Web Server in order to know what information to put into the cookie it will send back to the client
Continue Writing Code
Write the code for the Page_Load event
Page_Load follows Page_Init in the sequence of events
The code is executed only if the Page_Load event is occurring due do a PostBack from the server
A PostBack occurs because the user has interacted in a way to cause the server to resend the page (see page 1041 in the text for a more complete discussion of the postback event)
So the If condition is false when the page loads initially
Write the Code to Create the Cookie
The cookie is sent to the user’s computer via the Response object
Run the Application
Keep Running – Trying Out Different Functionality
Finish Section 25.4
Complete the application as in continues on pages 1051 through 1062 in the Deitel textbook
Time to Publish?
Uploading the contents of your Web application to the Web server is called publishing
Save all and Build!!!!! DO NOT FORGET TO BUILD IMMEDIATELY PRIOR TO PUBLISH !!!!!!
Choose Publish from the Build menu
Change the Publish Method to FPSE (Front Page Server Extensions)
Publish Your Web App
A subweb named ASP.NET_HandsOn_03 has been created for you under your username web folder
Type the full url as the Target Location:
http://cot-cis2336-01.cougarnet.uh.edu/secnnnnn/username/ASP.NET_HandsOn_03
http://cot-cis2336-01.cougarnet.uh.edu/secnnnnn/username/ASP.NET_HandsOn_03
See the Results (Hopefully You Won’t See Either of These)
If You Do See an Error
It may be because you forgot to build prior to publish
Try the Save All –Build – Publish routine again
Then email me if the error persists
ASP.NET Hands-OnLesson 03
By Susan L. Miertschin