<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>【ASP.NET】</title><link>http://blogs.wankuma.com/inogucci/category/589.aspx</link><description>ASP.NETに関する事</description><managingEditor>inogucci</managingEditor><dc:language>ja-JP</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>inogucci</dc:creator><title>Global.asax で処理するイベントをコードビハインド側に書くことは推奨されてない？？</title><link>http://blogs.wankuma.com/inogucci/archive/2007/01/24/58220.aspx</link><pubDate>Wed, 24 Jan 2007 01:22:00 GMT</pubDate><guid>http://blogs.wankuma.com/inogucci/archive/2007/01/24/58220.aspx</guid><wfw:comment>http://blogs.wankuma.com/inogucci/comments/58220.aspx</wfw:comment><comments>http://blogs.wankuma.com/inogucci/archive/2007/01/24/58220.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.wankuma.com/inogucci/comments/commentRss/58220.aspx</wfw:commentRss><trackback:ping>http://blogs.wankuma.com/inogucci/services/trackbacks/58220.aspx</trackback:ping><description>&lt;P&gt;今 ASP.NET2.0 でWebサイト構築中なのですが、匿名ユーザーにも&lt;/P&gt;
&lt;P&gt;プロフィルを使用して情報を持たせようと思っているのですが、&lt;/P&gt;
&lt;P&gt;匿名ユーザーがログイン後にプロファイルを移行するために呼ばれる&lt;/P&gt;
&lt;P&gt;Profile_MigrateAnonymous イベントがあるのですが、その中で Profile オブジェクト&lt;/P&gt;
&lt;P&gt;（正確には ProfileBase を継承した ProfileCommon というクラスで web.config の &lt;/P&gt;
&lt;P&gt;profile セクションで定義したプロパティを自動生成）を参照しようとしてもインテリセンスに表示されません。&lt;/P&gt;
&lt;P&gt;（もちろん無視して Profile.xxx と書いてもコンパイルエラー）&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;色々調査してわかりましたが、Global.asax に直接イベントを書いてその中で&lt;/P&gt;
&lt;P&gt;Profile オブジェクトを参照するのはできるようです。&lt;/P&gt;
&lt;P&gt;（この場合インテリセンスに表示される）&lt;/P&gt;
&lt;P&gt;ちなみに Global.asax がコンパイルされたソースファイルを見たところ、&lt;/P&gt;
&lt;P&gt;その中で Profile オブジェクトを返すプロパティが自動生成されています・・・Orz&lt;/P&gt;
&lt;P&gt;しかも Global.asax はコードビハインド側の Global クラスを継承してるから&lt;/P&gt;
&lt;P&gt;当然コードビハインド側では Profile オブジェクトは見えない&lt;/P&gt;
&lt;P&gt;(/≧◇≦＼)ｱﾁｬｰ!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ということで、コードビハインド側にコードを書かないほうがいいのでしょうかねぇ・・・&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src ="http://blogs.wankuma.com/inogucci/aggbug/58220.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>