0

アドオンをインストールできる Web アプリケーションがあります。これらのアドオンを作成するには、同じ構造を持つ新しい Web アプリケーションを作成し、メイン アプリケーションからアセンブリを参照します。

この後、aspx (マークアップ) ファイルをメイン アプリケーションにのみコピーします。これにより、マークアップ ページとアセンブリへの参照が作成され、デバッグできるようになります。

これは、私が修正を加えるまではすべて正常に機能していました。最後に作業してから変更されたのは、VS2010 SP1 のインストールだけです。

コードにポイントがあります-外部コードとしてどこで発生しているのか正確にはわかりませんが、セッションIDが変更されており、セッション内のすべてが失われています。

レポートを含む新しいウィンドウを開くコードがあります。

        string link = String.Format( "window.open('{0}');", Page.ResolveUrl( "~/CustomPages/BudgetOnlineMedia.aspx" ) );

        Page.ClientScript.RegisterStartupScript( this.GetType(), "MedReport", link, true );

この後、ベース ページでブレークポイントにヒットします。

/// <summary>
/// OnPreload
/// </summary>
/// <param name="e">args</param>
[VersionChange( "7.3.88.272", "13/04/2011", "Fully qualified path to login page" )]
protected override void OnPreLoad( EventArgs e )
{
    try
    {
        base.OnPreLoad( e );

        if ( base.CurrentUser == null )
        {
            Response.Redirect( "~/Pages/Login.aspx", false );
        }
    }
    catch ( Exception ex )
    {
        ErrorLogging.LogError( ex );
    }
}

同じブレークポイントが再びヒットしますが、今回は SessionID が変更されました!

この時点でコールスタックを読み取ることができますが、私のコードにはセッションを変更するものは何もありません。

スタック トレースは次のようになります。

>   Web.WAP.Objects.DLL!Web.WAP.Objects.Controls.UserPresencePage.OnPreLoad(System.EventArgs e) Line 28 C#
    System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint) + 0x22b bytes   
    System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint) + 0x84 bytes    
    System.Web.dll!System.Web.UI.Page.ProcessRequest() + 0x51 bytes 
    System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext context) + 0x16 bytes   
    System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context) + 0x32 bytes   
    App_Web_-ti4sydr.dll!ASP.custompages_budgetexhibition_aspx.ProcessRequest(System.Web.HttpContext context) + 0x33 bytes  C#
    System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 0xb6 bytes 
    System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously) + 0x4c bytes 
    System.Web.dll!System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(System.Exception error) + 0x133 bytes  
    System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback cb, object extraData) + 0x7c bytes  
    System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr) + 0x17c bytes 
    System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr) + 0x63 bytes  
    System.Web.dll!System.Web.HttpRuntime.ProcessRequest(System.Web.HttpWorkerRequest wr) + 0x47 bytes  
    WebDev.WebHost20.dll!Microsoft.VisualStudio.WebHost.Request.Process() + 0x177 bytes 
    WebDev.WebHost20.dll!Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Microsoft.VisualStudio.WebHost.Connection conn) + 0x6c bytes    
    [Appdomain Transition]  
    WebDev.WebHost20.dll!Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(object acceptedSocket) + 0xd3 bytes   
    mscorlib.dll!System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(object state) + 0x2f bytes   
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes    
    mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(System.Threading._ThreadPoolWaitCallback tpWaitCallBack) + 0x53 bytes 
    mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(object state) + 0x59 bytes    

【アプリドメイン移行】とは?

セッション ID を変更する原因が何かわかりますか!?

編集:

わかりました、これは VS SP1 ではなく IE10 プレビューに関連している可能性があります。

今、window.ShowModalDialog を実行すると、そのダイアログから window.open. Internet Explorer が新しいセッションを作成します

4

1 に答える 1

0

わかりました、これは VS SP1 ではなく IE10 プレビューに関連している可能性があります。

今、window.ShowModalDialog を実行すると、そのダイアログから window.open. Internet Explorer が新しいセッションを作成します

これは IE8 のバグのように見えましたが、IE10 に戻る可能性があります。

これは私が使用しなければならなかった回避策です。

ベースページでモーダルダイアログを表示します(ウィンドウオブジェクトを渡します)

/// <summary>
/// Shows a Page as a Modal dialog
/// </summary>
/// <param name="URL">The URL</param>
/// <param name="Width">The Width</param>
/// <param name="Height">The Height</param>
/// <param name="Resizable">Resizable?</param>
/// <param name="IfScript">Java script to run if the window returns true</param>
/// <param name="ElseScript">Java script to run if the window returns false</param>
protected void ShowModalDialog( string URL, int Width, int Height, bool Resizable, string IfScript, string ElseScript )
{
    try
    {
        string sModalDialog = @"
                                try
                                {{
                                    var args = new Object();
                                    args.window = window;
                                    if (window.showModalDialog('{0}', args, 'dialogHeight={1}px;dialogWidth={2}px;resizable={3}'))
                                    {{
                                        {4}
                                    }}
                                    else
                                    {{
                                        {5}
                                    }}
                                }}
                                catch (e)
                                {{
                                    alert(e.value);
                                }}";

        string vbs = String.Format( sModalDialog, URL, Height, Width, Resizable ? "yes" : "no", IfScript, ElseScript );

        base.ClientScript.RegisterStartupScript( this.GetType(), "ModalDialog", vbs, true );
    }
    catch ( Exception )
    {
        throw;
    }
}

そして、ポップアップ ウィンドウを開くための基本 Page メソッド (渡されたウィンドウ オブジェクトをチェックします)

       /// <summary>
    /// Shows a Popup Window
    /// </summary>
    /// <param name="Link">The link to show in the window</param>
    /// <param name="Width">The Width of the window</param>
    /// <param name="Height">The Height of the window</param>
    /// <param name="Name">The name of the window</param>
    /// <param name="ScrollBars">The Scroll bars to show</param>
    /// <param name="Resizable">Whether the window is resizable</param>
    /// <param name="ShowToolBar">Whether to show the toolbar</param>
    /// <param name="ShowStatusBar">Whether to show the status bar</param>
    /// <param name="ShowAddressBar">Whether to show the address bar</param>
    protected void OpenWindow( string Link, int Width, int Height, string Name, Sicon.API.Web.Enums.ScrollBars ScrollBars, bool Resizable, bool ShowToolBar, bool ShowStatusBar, bool ShowAddressBar )
    {
        try
        {
            StringBuilder sb = new StringBuilder();
            sb.Append( "try" );
            sb.Append( "{" );
            sb.AppendFormat( "Link='{0}';", Link );
            sb.AppendFormat( "Name='{0}';", Name.Replace( " ", "" ) );
            sb.Append( "    leftPos = 0;" );
            sb.Append( "    topPos = 0;" );
            sb.Append( "    if (screen) " );
            sb.Append( "    {" );
            sb.AppendFormat( "        leftPos = (screen.width / 2) - ( {0} / 2 );", Width );
            sb.AppendFormat( "        topPos = (screen.height / 2) - ( {0} / 2 );", Height );
            sb.Append( "    }" );
            sb.Append( @"
                        var myWindow = window;
                        if ((typeof(dialogArguments) !== 'undefined' && dialogArguments != null))
                        {
                            if (typeof(dialogArguments.window) !== 'undefined' && dialogArguments.window != null)
                            {
                                myWindow = dialogArguments.window;
                            }   
                        }
                        " );
            sb.AppendFormat( "    myWindow.open(Link,Name,'width={0},height={1},left=' + leftPos + ',top=' + topPos +' ", Width, Height );

            //Check whether to show Scroll Bars
            switch ( ScrollBars )
            {
                case Sicon.API.Web.Enums.ScrollBars.One:
                    sb.Append( ",scrollbars=1 " );

                    break;

                case Sicon.API.Web.Enums.ScrollBars.Two:
                    sb.Append( ",scrollbars=2 " );

                    break;
            }

            //Check whether the window is resizable
            if ( Resizable )
            {
                sb.Append( ",resizable " );
            }

            //Check Whether to show the toolbar
            if ( ShowToolBar )
            {
                sb.Append( ",toolbar " );
            }

            //Show the status bar
            if ( ShowStatusBar )
            {
                sb.Append( ", status " );
            }

            //Show the address bar
            if ( ShowAddressBar )
            {
                sb.Append( ", location " );
            }

            sb.Append( "');" );
            sb.Append( "}" );
            sb.Append( "catch (e)" );
            sb.Append( "{" );
            sb.Append( "    alert(e.value);" );
            sb.Append( "}" );

            Page.ClientScript.RegisterStartupScript( this.GetType(), Name, sb.ToString(), true );

            sb = null;
        }
        catch ( Exception )
        {
            throw;
        }
    }

次に、2 番目のウィンドウを開くページで (ベース ページ メソッドを呼び出します)

    protected void btnBudgetOnlineMedia_Click( object sender, EventArgs e )
    {
        try
        {
            base.OpenWindow( Page.ResolveUrl( "~/CustomPages/BudgetOnlineMedia.aspx" ),
                800,
                600,
                "Med Report", 
                API.Web.Enums.ScrollBars.Two,
                true,
                false,
                false,
                false );
        }
        catch ( Exception ex )
        {
            ErrorLogging.LogError( ex );
        }
    }

注:dialogArgumentsから渡されたウィンドウオブジェクトでwindow.openを呼び出しています。

もちろん、これは恐ろしいことです。誰かがより良い解決策を持っていますか?

この問題に関する情報はこちら:

http://support.microsoft.com/kb/831678

更新: IE10 のインストールに関連している可能性もあります。インターネット セキュリティ設定の一部がリセットされ、JavaScript に影響しているようです。コードでの回避策も、将来的にこれを回避するために実装するのに適しています。

于 2011-04-13T12:51:14.553 に答える