何か奇妙な問題があります。これは、ローカルの両方の作品コードはルートディレクトリで実行されますが、サブディレクトリでは実行されません
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lblVersion.Text = System.Environment.Version.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (lblHelloWorld.Text.Equals(string.Empty))
{
lblHelloWorld.Text = "Hello World";
}
else
{
lblHelloWorld.Text = "";
}
}
}
、そして私のpublic_htmlフォルダ内:
は、私は、コード
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>VERSIONS CHECK!!!</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblVersion" runat="server" />
</div>
<br />
<div>
<asp:Label ID="lblHelloWorld" runat="server" />
</div>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</p>
</form>
</body>
</html>
の部分と分離コードファイルを持っています。しかし、サブフォルダに同じファイルを置くと、public_html/folder1/folder2
のようにエラーが発生します。
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
私はASP.NETとVisual Studioで公開しているので、どこか間違ったことをする可能性があります。実際には、これはASP.NETを書くための私の最初の試みです - だから静かに:)
Thx。
ジャックこれは私の設定ファイルは、今どのように見えるかです:Visual Studioで
Asp.Net構成オプション。 >
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
<authentication mode="Windows"/>
<customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>
- 設定およびコメントの完全なリストは、通常 \ WINDOWS \ Microsoft.Net \ Frameworkの\ VX.X \ Configを に位置 machine.config.commentsで見つけることができますそして、私が今取得するエラーは:
'/'アプリケーションのサーバーエラーです。 構成エラー 説明:この要求を処理するために必要な構成ファイルの処理中にエラーが発生しました。以下の特定のエラーの詳細を確認し、設定ファイルを適切に変更してください。
パーサーエラーメッセージ:アプリケーションレベルを超えてallowDefinition = 'MachineToApplication'として登録されたセクションを使用するとエラーが発生します。このエラーは、仮想ディレクトリがIISのアプリケーションとして構成されていないために発生します。
ソースエラー:
Line 26: ASP.NET to identify an incoming user.
Line 27: -->
Line 28: <authentication mode="Windows"/>
Line 29:
Line 30:
私の問題は、PHPに使用していたので、私はVisual StudioでこのASP上で間違った角度を持っていたので、このすべてのトラブルがありました。私はビジュアルスタジオプロジェクトをウェブサイトとして見る必要があります。ビジュアルスタジオの構造は、私のftpの中を見ているようなものです。分かりました。正しい方向に私を導くThx: – fjappe
うれしい私は助けることができました! – zeroef