記事の個別表示(修正可)
タイトル  ApacheからASPを使う
本文  
 403のエラーメッセージを独自画面で表示する方法は、昨日の続きとして、出来た様な、大丈夫かな、と言う様な所だ。と言うのは、結局、apache/conf/extra/httpd-multilang-errordoc.conf の設定をいじってしまったからだ。出来たと言えば、出来た。そこはやり過ぎだろうと言われれば、そうですねと言う事になりそうだ。

 まあ、しばらくは、ネットの中をあちらこちら漁ってテストしてみよう。

 Viausl Basic 2010 を何とか、物にしたと思う。そこで、次は、ASPを動かす。それをテーマにしてみよう。ASPは、高機能だ。それで何がしたいと言うテーマは、無いが、とにかくやって見たい。そんな所だ。

 おはようのサーバー環境は、Apacheだ。となると、方法は2つある。一つは、Apacheの環境でASPを動かす方法。今一つは、ポートを変えてのIISの導入だ。折角Apacheを使って居るのだから、まずは、Apacheの環境下で、ASP環境を構築する方法を試す。

 ネットをググると、「How to make Apache run ASP.NET / ASP.NET 2.0」と言うサイトに出くわす。主な内容は、こうだ。

1.Apacheのインストール。 これは、今使って居るので必要ない。スキップだ。
2.Mod_AspDotNetのインストール。 これが必要なんだ。早速インストールする。
3.次は、Apacheの設定ファイルのhttpd.conf に追加とある。
 まず、インストールしたモジュールの宣言だ。
 3-1. LoadModule aspdotnet_module "modules/mod_aspdotnet.so"  でも、他のモジュールを見ると「"」が付いていないので、これを省略した。LoadModule文の一番最後に追加した。
 3-2. 次の文も追加だな。今の追加した文の次に入れて置こう。
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
 3-3. 次は、少々長いぞ、これは一番最後にしよう。
<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+)_(\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> 

 ここで注意が必要なのは、/SampleASP "c:/SampleASP" を自分の環境に合わせて変える事だ。試したのは、index.htmlのある場所にホルダーの「asp」を作ったとする。その場合、
/asp "c:/..../asp"となる事だ。変える個所は3か所ある。後は、そのままで良さそうだ。Apacheを再起動する。エラーも無さそうだ。

 で、次の分は、index.aspxの例か。
<%@ Page Language="VB" %>
<html>
   <head>
      <link rel="stylesheet"href="intro.css" mce_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>

 これを、先程のaspホルダーに名前をindex.aspxとして入れる。早速に、http://.../asp/index.aspxとすると、難なく起動した。感動だね。

...51525354555657585960...