HttpCapabilitiesBase.SupportsRedirectWithCookie プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ブラウザーがリダイレクト時に Cookie をサポートしているかどうかを示す値を取得します。
public:
virtual property bool SupportsRedirectWithCookie { bool get(); };
public virtual bool SupportsRedirectWithCookie { get; }
member this.SupportsRedirectWithCookie : bool
Public Overridable ReadOnly Property SupportsRedirectWithCookie As Boolean
プロパティ値
true ブラウザーがリダイレクトで Cookie をサポートしている場合。それ以外の場合は false。 既定値は、true です。
例
次のコード例は、ブラウザーがリダイレクト時に Cookie をサポートしているかどうかを判断する方法を示しています。
<%@ page language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load(Object Sender, EventArgs e)
{
CheckBrowserCaps();
}
void CheckBrowserCaps()
{
String labelText = "";
System.Web.HttpBrowserCapabilities myBrowserCaps = Request.Browser;
if (((System.Web.Configuration.HttpCapabilitiesBase)myBrowserCaps).SupportsRedirectWithCookie)
{
labelText = "Browser supports cookies on redirection.";
}
else
{
labelText = "Browser does not support cookies on redirection.";
}
Label1.Text = labelText;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Browser Capabilities Sample</title>
</head>
<body>
<form runat="server" id="form1">
<div>
Browser Capabilities:
<p/><asp:Label ID="Label1" Runat="server" />
</div>
</form>
</body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
CheckBrowserCaps()
End Sub
Function CheckBrowserCaps()
Dim labelText As String = ""
Dim myBrowserCaps As System.Web.HttpBrowserCapabilities = Request.Browser
If (CType(myBrowserCaps, System.Web.Configuration.HttpCapabilitiesBase)).SupportsRedirectWithCookie Then
labelText = "Browser supports cookies on redirection."
Else
labelText = "Browser does not support cookies on redirection."
End If
Label1.Text = labelText
End Function 'CheckBrowserCaps
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Browser Capabilities Sample</title>
</head>
<body>
<form runat="server" id="form1">
<div>
Browser Capabilities:
<p/><asp:Label ID="Label1" Runat="server" />
</div>
</form>
</body>
</html>
注釈
UP を使用します。ブラウザー 4.1 または UP。ブラウザー 3.2 では、Redirect メソッドは、HttpBrowserCapabilities オブジェクトの SupportsRedirectWithCookie プロパティの値がfalseされているかのように動作します。ただし、Web.config の SessionState セクションのCookieless プロパティが明示的にtrueに設定されていない場合。
ASP.NET 1.1 では、この設定のオプションは true または falseでしたが、ASP.NET 2.0 では選択肢が展開され、 AutoDetect が既定の設定になりました。 Web アプリケーションで、Web.config ファイルの <sessionState> セクションのcookieless属性がブール値に設定されている場合、Redirectは、これらのブラウザーで想定どおりに動作する必要があります。