ASP.NET with C# essay Essay
Debugging in ASP.Net:
System testing and debugging on large ASP.NET project takes too long. For every test, one needs to compile, load and authenticate. It takes more time loading, navigating and authenticating than one is spending testing and debugging.
While working on a large ASP.NET project where Microsoft Passport authentication is used the programmer has to go through unit testing. Every time the programmer wants to perform a test, he has to authenticate with Passport to get to the site.
This is what he has to do: Go to the IDE. Then hit the Start project button in the tool bar (F5), which builds and starts the project. Next, he has to wait for the project to load. Then he has to log into Passport (which takes a long time since hitting the development servers), and then he has to navigate to the page he wants to look at (which takes more time — even longer depending on which portion of the site being worked on). Then one has to test his code. If the programmer doesn’t quite get the code correct, then he has to stop the IDE, correct the code and do it all over again. This is a very time
Need essay sample on "ASP.NET with C# essay"? We will write a custom essay sample specifically for you for only $ 13.90/page
Here is a feature of VS.NET that saves him from having to wait for the IDE to load, log into passport, wait for the development Passport servers to authenticate him and then navigate to the correct section of the Web site before I can do the test.
1. Open up a browser. (Let’s call it “A.”) Go to the section that you are interested in viewing (“http://localhost/Subsection/ObscurePage.aspx” for example).
2. When he hits the “Debug -> Start” (F5 shortcut key) in the IDE, another browser (let’s call it “B”) opens up.
3. In the IDE, place a break point some where in the “ObscurePage.aspx.vb.”
4. Now, in Browser “A, initiate an event that will reload the page (a button click, or just reload the page). Browser “A” will then go into debug mode even though Browser “B” is the browser that was associated with the debugging session.
5. Step through the code.
Microsoft .NET supports not only language independence, but also language integration. This means that the programmer can inherit from the classes, catch exceptions, and take advantage of polymorphism across different languages. The .NET technology for building web applications (and dynamic web sites) is ASP. NET, which provides a rich collection of types for building web applications in its System. Web and System. Web. UI namespaces. There is a great deal to learn about ASP. NET, but much of it is language independent. ASP. NET offers a rich suite of controls and related tools, including tools to validate data, display dates, present advertisements, interact with users, and so forth. Most of this requires no coding whatsoever (Liberty 5, 401 & 402)
ASP is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
ASP is a Microsoft Technology. ASP stands for Active Server Pages. It is a program that runs inside IIS, stands for Internet Information Services. IIS comes as a free component with Windows 2000. It is also a part of the Windows NT 4.0 Option Pack. PWS is a smaller – but fully functional – version of IIS. ASP file is just the same as an HTML file. An ASP file can contain text, HTML, XML, and scripts. Scripts in an ASP file are executed on the server. An ASP file has the file extension “.asp”
When a browser requests an HTML file, the server returns the file. Similarly, when a browser requests an ASP file, IIS passes the request to the ASP engine on the server. The ASP engine reads the file, line by line, and executes the scripts in the file. Finally, the ASP file is returned to the browser as plain HTML
Before one study ASP .NET, it would help to have a basic understanding of Microsoft’s ASP technology. (ASP. NET Introduction)
Web forms bring Rapid Application Development (RAD) techniques (such as those used in Windows Forms) to the development of web applications. As with the Windows Forms, drag and drop controls onto a form and write the supporting code either inline on in code-behind pages. With web forms, however, the application is deployed to a web server, and users interact with the application through a standard browser. .NET Web Services expand on the concept of distributed processing to build components whose methods can be invoked across the Internet. Any .NET language can build these components, and they communicate using open protocols that are platform-independent. For instance a stock exchange server might provide a web service method that takes a stock ticker symbol as a parameter and returns a quote. An application might combine that service with another service from a different company that also takes a stock symbol but that background data about the company. The application developer can concentrate on adding value to these services, rather than duplicating the same service for his own application.
Wed Forms implement a programming model in which web pages are dynamically generated on a web server for delivery to a browser over the Internet. They are, in some ways, the successor to ASP pages, and they marry ASP technology with traditional programming.
With Web Forms, you create an HTML page with static content, and you write C# code to generate dynamic content. The C# code runs on the server, and the data produced is integrated with your static HTML to create the web page. What is sent to the browser is standard HTML.
Web forms are designed to run on any browser, with the server rendering the correct browser-complaint HTML. Your can do the programming for the logic of the web from in any .NET language. I will of course use C# which is arguably the language of choice, though some ASP developers who have used VBscript might opt for VB.NET.
Just as with Windows Forms, you can create Web Forms in Notepad (or another editor of your choice) rather than in Visual Studio. Many developers will choose to do so, but Visual Studio makes the process of designing and testing Web Forms much easier.
Web Forms divide the user interface into two parts: the visual part or user interface (UI), and logic that lies behind it. This is very similar to developing Windows Forms. Web Forms the UI page and the code are in separate files.
The UI page is stored in a file with the extension. aspx. The logic (code) for that page can be stored in a separate code-behind C# source file. When you run the form, the code-behind class file runs and dynamically creates the HTML: sent to the client browser. This code makes use of the rich Web Forms types found in the system.Web and System.Web.UI namespaces of the .NET Framework Class Library (FCL)(Liberty, 401 & 402).
NET Web Services help you write components whose methods can be moved across; the Internet using any .NET programming: Language, Developers, who are creating web services can build one upon another, taking advantage of the connectivity that is at the heart of the Web Adding value takes precedence over reinventing the wheel.
The list of web services that might be useful to developers and end users seems boundless. A bookstore might provide a web server that takes an ISBN and returns the price and availability of a title. A hotel’s web services might take a telephone number and return a name and address. Yet another might provide information about the weather or shuttle launches.
Microsoft has announced a number of commercial Net services as part of its .NET My Services initiative, among these are is passport services for identifying and authenticating users as well as services for managing storage, notification, appointments, and a host of other applications. These services, as well as the ones you write, can be integrated with your applications just like any outer business object.
In such a world, a single application might draw on and stitch together the services of hundreds of small web services distributed all over the world. This takes the web to an entirely new dimension: not only is information retrieved and exchange, but also methods are – and applications are executed (Liberty, 421)
In this section we’ll build a simple web service to demonstrate the fundamentals of web service building. Our web service will contain just one method called HighCommunicationMethod. HighCommunicationMethod returns a string, “HighCommunication”.
Before building a web service, a virtual directory or web application must be created using IIS. We can do this by loading the IIS snap-in with MMC (start -> run -> “mmc” -> console -> open -> c:\winnt\system32\inetsrv\iis.mmc), right clicking on your web site and choosing new -> virtual directory. Call the virtual directory “HighCommunication”.
The following code shows the most basic web service:
<%@ WebService Language=”C#” class=”High Communication”%>
public class High Communication: WebService
public string HighCommunicationMethod()
return “High Communication”;
Copy the code above into your favorite text editor and save the file into the virtual directory we created above as High Communication. asmx.
The file extension for a web service is .asmx.
We can now access our High Communication web service in our browser by visiting http://localhost/HighCommunication/HighCommunication.asmx.
If our method actually took a parameter, we would be given a text box for us to enter its value into. However, because our method doesn’t take any parameters only the invoke button is provided, which will run the method and display the returned output as XML. This page is especially useful for testing purposes during the development and also to allow consumers to check if the web service is what they expected it to be.
ASP.NET Introduction, (1999). Refsnes Data, available from http://www.w3schools.com/aspnet/aspnet_intro.asp
James Yang, (2002). Building XML Web Services Using C# and ASP.NET – A simple web service available from http://www.devarticles.com/c/a/ASP.NET/Building-XML-Web-Services-Using-C-sharp-and-ASP.NET/2/
Liberty, J., Programming C#: Building .NET Applications, 3rd Edition, Liberty, pg. 5 & 401-432