PDA

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



supera
Feb 03, 2012, 7:52 PM
Hi!

I get a problem in my main page and the logout button.

I have a viewPort in my main Page.
In viewPort.Items, I add a ext:Panel and a gridPanel.
In ext:Panel, Im loading a aspx page call Header.aspx, with default header by application.
In default header aspx page, there are a button called btnLogout. When i click in this button, i should be redirect to a logout.aspx page...
The problem that occurs is that the page logout.aspx is opened IN panel... i.e, the logout.aspx is opened in Panel and the grid is visible at the bottom of main page.

Thanks for any help!

Daniil
Feb 03, 2012, 8:00 PM
Hi,

Did you use Mode="Load" for the Loader, right?

supera
Feb 06, 2012, 10:34 AM
Hi Daniil...

Yes.. follows the code



<ext:Panel ID="tabHeader" runat="server" Region="North" Border="false" Header="false" Height="60px">
<Loader runat="server" Mode="Frame" AutoLoad="true" Url="~/App/SuperaWebHeader.aspx" >
<LoadMask ShowMask="true"/>
</Loader>
</ext:Panel>

Daniil
Feb 06, 2012, 10:41 AM
Please follow:
http://forums.ext.net/showthread.php?14379

supera
Feb 06, 2012, 12:06 PM
Hi Daniil

I try follow the example in the thread you sent me, but Im not working.
I am having two problems:

1 - In <DirectMethod> (follow), I get the message 'Redirect is not a member of 'Ext.net.BuilderFactory''.


<DirectMethod()>
Public Sub Redirect(url As String)
X.Redirect(url)
End Sub


2 - The method Redirect is not being called.
2.1 - I replace X.Redirect(url) to Response.Redirect(url) in Redirect function on default.aspx and set a breakpoint in this code line.
2.2 - In testHeader.aspx, code behind event LoginStatus1_LoggingOut, I insert the code bellow, and set a breakpoint to.


<script runat="server">
Protected Sub LoginStatus1_LoggingOut(sender As Object, e As System.Web.UI.WebControls.LoginCancelEventArgs) Handles LoginStatus1.LoggingOut
'Server.TransferRequest("")
'Response.Redirect("~/app/logins/loginout.aspx", True)
'ClientScript.RegisterStartupScript(Me.GetType(), "scriptid", "window.parent.location.href='/app/logins/loginout.aspx'", True)
'Server.TransferRequest("~/app/logins/loginout.aspx")
Ext.Net.X.Js.Call("parent.Ext.net.DirectMethods.Redirect", "loginout.aspx")
End Sub
</script>


The event LoginStatus1_LogginOut is fired of testheader.aspx is fired, but the function Redirect in default.aspx page is not fired.

Follow the page code

Default.aspx


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" Inherits="WebApplication2.Default1" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

<DirectMethod()>
Public Sub Redirect(url As String)
'X.Redirect(url)
Response.Redirect(url)
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'autenticado
'FormsAuthentication.RedirectFromLoginPage("teste", True)
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="resManagerSuperaWebLogins" runat="server" Namespace="SuperaWeb" />
<ext:Viewport ID="Viewport1" runat="server">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:Panel ID="tabHeader" runat="server" Region="North" Border="false" Height="60px">
<Loader ID="Loader1" runat="server" Mode="Frame" AutoLoad="true" Url="testheader.aspx" >
<LoadMask ShowMask="true"/>
</Loader>
</ext:Panel>
<ext:Panel runat="server" Border="true" Title="Main content" Flex="1" />
</Items>
</ext:Viewport>
</body>
</html>


testheader.aspx


<%@ Page Language="vb" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub LoginStatus1_LoggingOut(sender As Object, e As System.Web.UI.WebControls.LoginCancelEventArgs) Handles LoginStatus1.LoggingOut
'Server.TransferRequest("")
'Response.Redirect("~/app/logins/loginout.aspx", True)
'ClientScript.RegisterStartupScript(Me.GetType(), "scriptid", "window.parent.location.href='/app/logins/loginout.aspx'", True)
'Server.TransferRequest("~/app/logins/loginout.aspx")
Ext.Net.X.Js.Call("parent.Ext.net.DirectMethods.Redirect", "loginout.aspx")
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body style="padding: 0px 0px 0px 0px; margin:0px 0px 0px 0px;">
<ext:ResourceManager ID="ResourceManager1" runat="server" Locale="pt-BR" Namespace="SuperaWeb" />
<form id="SuperaWebHeader" runat="server">
<div id="header" style="padding: 0px 0px 0px 0px; margin:0px 0px 0px 0px;"><h1><font style='color: #15428B;'>
<asp:Label runat="server" ID="lblTitle" Text="SuperaWEB" Width="600" style="position:fixed; top:5px; left:80px;"/></font></h1>
<asp:Label runat="server" ID="lblUsuario" style="position:fixed; top:23px; right:70px;"/>
<asp:LoginStatus ID="LoginStatus1" runat="server" style="position:fixed; top:23px; right:30px;" />
<asp:Label runat="server" ID="lblEmpresa" style="position:fixed; top:42px; right:30px; color:White;"/>
</div>
</form>
</body>
</html


LoginOut.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="loginout.aspx.vb" Inherits="WebApplication2.loginout" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" Locale="pt-BR" Namespace="SuperaWeb" />
<form id="form1" runat="server">
<div>
<ext:Window ID="wndLoginOut"
runat="server"
Title="SUPERAWEB logout!"
Width="440"
Height="220"
BodyPadding="10"
Resizable="false"
Closable="false"
Layout="FitLayout"
icon="Information">
<Items>
<ext:Panel runat="server" ID="paneLoginOut" Layout="ColumnLayout" BodyPadding="10" BodyStyle="background-color:transparent" Icon="Cancel">
<Items>
<ext:Container runat="server" ColumnWidth=".3" >
<Items>
<ext:Image runat="server" ID="imgError" Height="70" Width="70" ImageUrl="~/resources/images/icons/logout.png"/>
</Items>
</ext:Container>
<ext:Label runat="server" ID="txtDescription" ColumnWidth=".7" html="<b><n>Voc est se deslogando da SuperaWeb...</n></b>"/>
</Items>
</ext:Panel>
</Items>
</ext:Window>
</div>
</form>
</body>
</html>

Daniil
Feb 06, 2012, 12:19 PM
In VB you should use:

ExtNet.Redirect
instead of

X.Redirect

Also, this

Ext.Net.X.Js.Call("parent.Ext.net.DirectMethods.Redirect", "loginout.aspx")
must be called within a DirectEvent/DirectMethod, not a hard postback.

supera
Feb 06, 2012, 12:55 PM
Daniil...

Its working fine now...

Thanks a lot.