Asp.Net
ASP.NET First Program Example: Hello World
Let's look at an example of how we can implement a simple "hello world" application. For this, we...
IIS or Internet Information Server is the server used to host .Net web applications. IIS is normally installed on a Window Server.
For users to access a website, it is required that the website is hosted on some sort of web server. There are different web servers available for different technologies. In .Net, the web server available is called Internet Information Services or IIS.
Once the web application is developed, it is then deployed on an IIS Server. This web application can then be accessed by the end users. There are two ways to deploy an application to the server, you will see both over here.
In this tutorial, you will learn-
The below diagram shows the process flow for an IIS Server.
Let's look how we can install IIS on a Window Server.
Step 1) On Windows Server 2012, the default dashboard is shown as below.
Step 2) On the next screen, you need to click the Next button to proceed.
Step 3) In the next step, we need to perform two substeps
Step 4) In the next screen, you will see the name of the server on which the installation is taking place. Click the Next button to proceed.
Step 5) In the next step, we need to perform two substeps
Step 6) In the subsequent screen, click the next button to proceed.
Step 7) In the final screen, click the Install button to begin the installation.
Once IIS has been installed, you can launch it, by going to search in Windows 2012.
After you click on the above link, IIS will open, and you will be presented with the below screen.
In IIS, you will have an initial site set up called Default Web Site.
If you open up your browser and go to the URL http://localhost. You will see the below output. This URL mainly goes to the Default Web site shown in the previous screen. This is the default page which indicates that the IIS Server is up and running.
After developing a web application, the next important step is to deploy the web application. The web application needs to be deployed so that it can be accessed by other users. The deployment is done to an IIS Web server.
There are various ways to deploy a web application. Let's look at the first method which is the File copy.
We use the web application created in the earlier sections. Let's follow the below-mentioned steps to achieve this.
Step 1) Let's first ensure we have our web application 'DemoApplication' open in Visual Studio.
Step 2) Open the 'Demo.aspx' file and enter the string "Guru 99 ASP.Net."
<!DOCTYPE html>
<html xmlns="http://www.w3.ore/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server”>
<div>
Guru 99 ASP.Net
</div>
</form>
</body>
</html>Now just run the application in Visual Studio to make sure it works.
Output:-
The text 'Guru 99 ASP.Net' is displayed. You should get the above output in the browser.
Step 3) Now it's time to publish the solution.
It will open another screen (see step below).
Step 4) In the next step, choose the 'New Profile' to create a new Publish profile. The publish profile will have the settings for publishing the web application via File copy.
Step 5) In the next screen we have to provide the details of the profile.
Step 6) In this step, we specifically mention that we are going to Publish website via File copy.
Step 7) In the next screen, click the Next button to proceed.
Step 8) Click the 'Publish' button in the final screen
When all of the above steps are executed, you will get the following output in Visual Studio
Output:-
From the output, you will see that the Publish succeeded.
Now just open the browser and go to the URL – http://localhost/Demo.aspx
You can see from the output that now when you browse to http://localhost/Demo.aspx , the page appears. It also displays the text 'Guru 99 ASP.Net'.
Another method to deploy the web application is via publishing a website. The key difference in this method is that
Let's use the same Demo Application and see how we can publish using the "website publish method."
Step 1) In this step,
Step 2) On the next screen, select the 'New Profile' option to create a new Publish profile. The publish profile will have the settings for publishing the web application via Web Deploy.
Step 3) In the next screen we have to provide the details of the profile.
Step 4) In the next screen, you need to give all the details for the publish process
Step 5) Click the 'Next' button on the following screen to continue
Step 6) Finally, click the Publish button to publish the Website
When all of the above steps are executed, you will get the following output in Visual Studio.
Output:-
From the output, you will see that the Publish succeeded.
Now just open the browser and go to the URL – http://localhost/Demo.aspx
You can see from the output that now when you browse to http://localhost/Demo.aspx , the page appears. It also displays the text Guru 99 ASP.Net.
Summary
Let's look at an example of how we can implement a simple "hello world" application. For this, we...
Accessing Data from a database is an important aspect of any programming language. It is necessary for any...
In any application, errors are bound to occur during the development process. It is important to...
Download PDF 1) What is Web API? WebAPI is a framework which helps you to build/develop HTTP...
Testing is an essential aspect of any programming language. Testing for ASP.Net applications is...
In this tutorial, you will learn- What is ASP.Net Life cycle? What is ASP.Net Page Life cycle?...