ASP.NET でSessionCookie、Cookie認証Ticketを共有する方法
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicros...
-戻る
--[[ASP.NET (配置)>ASP.NET#g0d096ef]]
--[[ASP.NET Session]]
--[[ASP.NET Forms認証>ASP.NET Forms認証#zf3414e4]]
* 目次 [#t044be2a]
#contents
*概要 [#x37fa4d3]
-[[VSソリューション プロジェクトの構成検討]]~
にも書いたように、プロジェクト分割したいケースがある。
-ASP.NETアプリケーションのP層部分のプロジェクトを分割する...
[[SessionCookie>#qe11459f]]と、[[Cookie認証Ticket>#ze16e0...
≒ Sessionが分割され、SSOもできない状態になる。
-必要に応じて、
--[[SessionCookie>#qe11459f]]
--[[Cookie認証Ticket>#ze16e02e]]
>を共有する設定が必要になる。
*詳細 [#z4124bde]
**SessionCookie [#qe11459f]
下記の処置を施せば、Sessionを共有可能と思われる(未検証
***SessionCookie [#ceeedc54]
-SessionCookieを共有するサイトのドメインを指定する。
-SessionCookie名を一致させる(既定値はASP.NET_SessionIdで...
***Sessionデータ [#g4925816]
-当然、InProcモードではNGなので、StateServerモードを選択...
-machineKeyを設定する(同一マシンなら不要?)。
-アプリケーション名を設定する(設定処理はGlobal.asaxなど...
<system.web>
<!-- Cookieを共有するサイトのドメインを指定-->
<httpCookies domain=".your.site"/>
<!-- セッション StateServerにセッション保存、セッショ...
<sessionState
cookieless="UseCookies"
cookieName="ASP.NET_SessionId"
mode="StateServer"
regenerateExpiredSessionId="false"
stateConnectionString="tcpip=10.1.1.1:42424"
timeout="30">
</sessionState>
<!-- machineKeyを設定-->
<machineKey
validationKey="..."
decryptionKey="..."
validation="SHA1" decryption="AES" />
</system.web>
<appSettings>
<!-- アプリケーション名を設定-->
<add key="ApplicationName" value="appName" />
</appSettings>
**Cookie認証Ticket [#ze16e02e]
また、Forms認証のCookie認証Ticketついては、
-Cookie認証Ticket名だけ一致させておけば共有できる(既定値...
-ドメイン
--単一サイト内ならドメイン指定を省略出来るが、明記するこ...
--ドメイン間(サブ・ドメイン間)で共有するには、~
EnableCrossAppRedirectsをtrueに設定する。
<authentication mode="Forms" >
<!-- The name, protection, and path attributes must ma...
exactly in each Web.config file. -->
<forms loginUrl="login.aspx"
name=".ASPXFORMSAUTH"
protection="All"
path="/"
domain="contoso.com"
timeout="30" />
</authentication>
*参考 [#wecc42b2]
**SessionCookie [#ic4b59e2]
-[ASP.NET][IIS]別アプリケーション&別サーバでセッションを...
https://qiita.com/mak_in/items/60f593188e770c7b7ba1
--c# - Share Session between two web sites using asp.net ...
https://stackoverflow.com/questions/3438912/share-session...
--Sharing session between two asp.net web applications~
http://www.freshcodehub.com/Article/48/sharing-session-be...
**Cookie認証Ticket [#sd588c40]
***Microsoft Docs [#p5e07b0a]
-FormsAuthentication.EnableCrossAppRedirects Property (Sy...
https://docs.microsoft.com/ja-jp/dotnet/api/system.web.se...
-Forms Authentication Across Applications~
https://docs.microsoft.com/ja-jp/previous-versions/aspnet...
***コードログ [#df52c40d]
-c# – EnableCrossAppRedirects~
クロスドメイン機能はどこで文書化されていますか?~
https://codeday.me/jp/qa/20190405/518500.html
-asp.net – クロスドメインフォーム認証クッキーの適切な作成~
https://codeday.me/jp/qa/20190416/641578.html
----
Tags: [[:.NET開発]], [[:ASP.NET]]
終了行:
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicros...
-戻る
--[[ASP.NET (配置)>ASP.NET#g0d096ef]]
--[[ASP.NET Session]]
--[[ASP.NET Forms認証>ASP.NET Forms認証#zf3414e4]]
* 目次 [#t044be2a]
#contents
*概要 [#x37fa4d3]
-[[VSソリューション プロジェクトの構成検討]]~
にも書いたように、プロジェクト分割したいケースがある。
-ASP.NETアプリケーションのP層部分のプロジェクトを分割する...
[[SessionCookie>#qe11459f]]と、[[Cookie認証Ticket>#ze16e0...
≒ Sessionが分割され、SSOもできない状態になる。
-必要に応じて、
--[[SessionCookie>#qe11459f]]
--[[Cookie認証Ticket>#ze16e02e]]
>を共有する設定が必要になる。
*詳細 [#z4124bde]
**SessionCookie [#qe11459f]
下記の処置を施せば、Sessionを共有可能と思われる(未検証
***SessionCookie [#ceeedc54]
-SessionCookieを共有するサイトのドメインを指定する。
-SessionCookie名を一致させる(既定値はASP.NET_SessionIdで...
***Sessionデータ [#g4925816]
-当然、InProcモードではNGなので、StateServerモードを選択...
-machineKeyを設定する(同一マシンなら不要?)。
-アプリケーション名を設定する(設定処理はGlobal.asaxなど...
<system.web>
<!-- Cookieを共有するサイトのドメインを指定-->
<httpCookies domain=".your.site"/>
<!-- セッション StateServerにセッション保存、セッショ...
<sessionState
cookieless="UseCookies"
cookieName="ASP.NET_SessionId"
mode="StateServer"
regenerateExpiredSessionId="false"
stateConnectionString="tcpip=10.1.1.1:42424"
timeout="30">
</sessionState>
<!-- machineKeyを設定-->
<machineKey
validationKey="..."
decryptionKey="..."
validation="SHA1" decryption="AES" />
</system.web>
<appSettings>
<!-- アプリケーション名を設定-->
<add key="ApplicationName" value="appName" />
</appSettings>
**Cookie認証Ticket [#ze16e02e]
また、Forms認証のCookie認証Ticketついては、
-Cookie認証Ticket名だけ一致させておけば共有できる(既定値...
-ドメイン
--単一サイト内ならドメイン指定を省略出来るが、明記するこ...
--ドメイン間(サブ・ドメイン間)で共有するには、~
EnableCrossAppRedirectsをtrueに設定する。
<authentication mode="Forms" >
<!-- The name, protection, and path attributes must ma...
exactly in each Web.config file. -->
<forms loginUrl="login.aspx"
name=".ASPXFORMSAUTH"
protection="All"
path="/"
domain="contoso.com"
timeout="30" />
</authentication>
*参考 [#wecc42b2]
**SessionCookie [#ic4b59e2]
-[ASP.NET][IIS]別アプリケーション&別サーバでセッションを...
https://qiita.com/mak_in/items/60f593188e770c7b7ba1
--c# - Share Session between two web sites using asp.net ...
https://stackoverflow.com/questions/3438912/share-session...
--Sharing session between two asp.net web applications~
http://www.freshcodehub.com/Article/48/sharing-session-be...
**Cookie認証Ticket [#sd588c40]
***Microsoft Docs [#p5e07b0a]
-FormsAuthentication.EnableCrossAppRedirects Property (Sy...
https://docs.microsoft.com/ja-jp/dotnet/api/system.web.se...
-Forms Authentication Across Applications~
https://docs.microsoft.com/ja-jp/previous-versions/aspnet...
***コードログ [#df52c40d]
-c# – EnableCrossAppRedirects~
クロスドメイン機能はどこで文書化されていますか?~
https://codeday.me/jp/qa/20190405/518500.html
-asp.net – クロスドメインフォーム認証クッキーの適切な作成~
https://codeday.me/jp/qa/20190416/641578.html
----
Tags: [[:.NET開発]], [[:ASP.NET]]
ページ名: