View Full Version : [CLOSED] MessageBusDirectEvents with Response.Redirect

Dec 03, 2013, 9:26 AM
This is my example:


<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Page.master.cs" Inherits="test2.Page" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void ServerBusEvent(object sender, DirectEventArgs e)
X.Msg.Show(new MessageBoxConfig() { Message = "It works!!!: " + e.ExtraParams["message"] });
<!DOCTYPE html>

<head runat="server">
<link href="/resources/css/examples.css" rel="stylesheet" />
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />

<ext:Viewport runat="server" Layout="BorderLayout">
<ext:Container runat="server" ID="pane1" Title="Global logger in master page" Height="150" Region="North" Layout="FitLayout">

<ext:MessageBusDirectEvent Name="**" OnEvent="ServerBusEvent">
<ext:Parameter Name="message" Value="data" Mode="Raw" />

<ext:Container runat="server" Layout="FitLayout" Region="Center">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">


<%@ Page Title="" Language="C#" MasterPageFile="Page.Master"%>
<script runat="server">
protected void click(object sender, DirectEventArgs e)
MessageBus.Default.Publish("Msg.Server", "It is an event from server side");
Response.Redirect("Default.aspx"); //after comment out this line, it works
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<ext:Container runat="server" Title="Container in content page">
<ext:VBoxLayoutConfig Align="Stretch" />
<ext:Button runat="server" ID="test" Text="test" Width="100" Height="50">
<Click OnEvent="click"></Click>

Is there any way to call MessageBus an redirect in the same DirectEvent?

Dec 03, 2013, 10:18 AM
Hi @ViDom,

Anyway, redirection won't wait execution of the ServerBusEvent handler.

The only suitable way is to redirect inside the ServerBusEvent handler or in its Success handler.