How to run ASP. NET and ASP. NET 2.0 on Apache

Source: Internet
Author: User

I believe that when you see this question, you must be a bit happy. Haha, my program is no longer limited to IIS, and finally there are multiple choices. Now, let's start to translate the Microsoft MVP article and worship ing.
The original post address of the article is: http://weblogs.asp.net/israelio/archive/2005/09/11/424852.aspx

The following are prerequisites for enabling ASP. NET to run on apache:
1. install Apache 2.0.54;
2. Install Mod_AspDotNet;
3. In the fileC: \ Program Files \ Apache Group \ Apache2 \ conf \ httpd. confTo add the following lines. (Haha, MVPer forgot to talk about it. This configuration file can be found in this path only when it is installed by default)

# Asp.net
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo

<IfModule mod_aspdotnet.cpp>
# Mount the ASP. NET/asp application
AspNetMount/SampleASP "c:/SampleASP"
#/SampleASP is the alias name for asp.net to execute
# "C:/SampleASP" is the actual execution of files/folders in that location

# Map all requests for/asp to the application files
Alias/SampleASP "c:/SampleASP"
# Maps/SampleASP request to "c:/SampleASP"
# Now to get to the/SampleASP type http: // localhost/SampleASP
# It'll redirect http: // localhost/SampleASP to "c:/SampleASP"

# Allow asp.net scripts to be executed in the/SampleASP example
<Directory "c:/SampleASP">
Options FollowSymlinks ExecCGI
Order allow, deny
Allow from all
DirectoryIndex index.htm index. aspx
# Default the index page to. htm and. aspx
</Directory>

# For all virtual ASP. NET webs, we need the aspnet_client files
# To serve the client-side helper scripts.
AliasMatch/aspnet_client/system_web/(\ d +) _ (\ d + )/(. *) "C:/Windows/Microsoft. NET/Framework/v $1. $2. $3/ASP. NETClientFiles/$4"
<Directory "C:/Windows/Microsoft. NET/Framework/v */ASP. NETClientFiles">
Options FollowSymlinks
Order allow, deny
Allow from all
</Directory>
</IfModule>
# Asp.net

After completing the above steps, it is time to show off. (Self-added)
1. CreateC: \ SampleASPDirectory, and createIndex. aspxFile;
2. Restart the apache server:
Start->Apache HTTP Server 2.0.54->
Control Apache Server-> Restart

3. Open your browser and enter the addressHttp: // localhost/SampleASP/index. aspx

If each step can be completed correctly, asp.net will be perfectly visible to you.

The following is an example of index. aspx written by MVPer using VB:

-Index. aspx-

<% @ Page Language = "VB" %>
<Html>
<Head>
<Link rel = "stylesheet" href = "intro.css">
</Head>
<Body>
<Center>
<Form action = "index. aspx" method = "post">
<H3> Name: <input id = "Name" type = text>
Category: <select id = "Category" size = 1>
<Option> One </option>
<Option> Two </option>
<Option> Three </option>
</Select>
</H3>
<Input type = submit value = "Lookup">
<P>
<% Dim I As Integer
For I = 0 to 7%>
<Font size = "<% = I %>"> Sample ASP. NET TEST </font> <br>
<% Next %>
</Form>
</Center>
</Body>
</Html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.