はオプションがありません。
IISからのセッションまたは@ENABLESESSIONSTATEディレクティブを使用してセッションを無効にし(ASP - >セッションのプロパティ - >セッション状態を有効にするfalse)、aspから提供される独自のCookieを使用することができます。しかし、アプリケーションでセッションオブジェクトが必要ない場合にのみ、これは問題ありません。
より良いアプローチは、正規表現(ASP版はすでにアンソニー・W・ジョーンズによって提示される)、または.NETで(最小限の単純化されたC#サンプル)を使用して、ログファイル内のこれらの「文字列」を変更することです:
Regex rx = new Regex("ASPSESSIONID[A-Z]+=");
string log = rx.Replace(File.ReadAllText("u_ex120618.log"), "ASPSESSIONID=");
Console.WriteLine(log);
詳細約aspxとIIS
1つのオプションは、ヘッダーを削除するためにハンドラを使用することです。あなたはIISマネージャへのアクセスを持っていないケースをカバー -
public class RemoveHttpHeadersModule : IHttpModule
{
public RemoveHttpHeadersModule()
{
}
public void Dispose()
{
}
public void Init(HttpApplication context)
{
if (context != null)
context.PreSendRequestHeaders += this.OnPreSendRequestHeaders;
}
[SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Web.HttpResponse.#get_Headers()")]
private void OnPreSendRequestHeaders(object sender, EventArgs e)
{
try
{
HttpContext.Current.Response.Headers.Remove("ETag");
HttpContext.Current.Response.Headers.Remove("Server");
HttpContext.Current.Response.Headers.Add("Server", "my server");
}
catch (HttpException)
{
throw;
}
}
}
別のオプションは、Global.asaxの中にすべてのもの(コードやコンパイルされたライブラリ)を制御することです。
削除(および/または追加)ヘッダー:
protected internal void Application_PreSendRequestHeaders(object sender, EventArgs e)
{
HttpContext.Current.Response.Headers.Remove("X-AspNet-Version");
HttpContext.Current.Response.Headers.Remove("X-Powered-By");
HttpContext.Current.Response.Headers.Remove("ETag");
HttpContext.Current.Response.Headers.Remove("Server");
}
次のステップは、ASPXを非表示にされたハンドルエラー
protected internal void Application_Error(object sender, EventArgs e)
{
// get the error code
int ec = ((HttpException)HttpContext.Current.Error).GetHttpCode();
// get the request path
// string req = HttpContext.Current.Request.Path;
// *** I suggest you to log the error before moving on
// clear the error to avoid IIS actions
HttpContext.Current.Server.ClearError();
if (ec == 404)
{
// do what ever you want
}
// ... add other error codes handling;
}
。 What is the proper way to map .html to the ASP.NET pipeline in IIS7
ちょうど正しいフレームワークのバージョンを選択するように注意する:
はこれがここで回答され.htmlのよう私たちは.aspxページを提示したいと仮定します。 IISマネージャーにアクセスできない場合は、Webを変更してください。(この作業のために必要なもののみ提示)設定:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="htmlpipe" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
</handlers>
</system.webServer>
</configuration>
上記の設定は、サーバなどの同じ基本属性(フレームワークのバージョン、32/64ビット)でのテスト環境を持って、あなたのPCに異なる可能性があり、作りますIISの変更を確認し、web.configで生成されたエントリを確認してください。
私にジョークを許可します。 "あなたはこの製品が好きですか?"
ありがとうフランク、あなたは古いディスクを差し込んで、忘れられたものを見つけました。従来のASPの提案がないのは残念です。
PS。 HackedByChineseの答えを忘れないでください。あなたが作成した最後のものを除いて、すべてのセッションクッキーを取り除きたい場合は
何????????あなたは "ASP.NET_SessionId"を意味しますか?クッキー ? –
@frankはあなたが実際にここで検索したものではありません。検索/リリースでログのこのクッキー名を変更する必要がありますか?またはあなたはASPでこれを変更するために勝ったのですか? - またはあなたはasp.netでこれを変更するために勝ったのですか?もっと明確にしてください – Aristos
バウンティはこの質問を始めましたが、賞金に添付されている説明は実際の質問とかなり異なります。 – AnthonyWJones