Les cuento mi siguiente problema tengo una variable de sesion en login.aspx y lo usa default.aspx y default2.aspx.
El Tema es que default2.aspx carga bien la sesion
y
default.aspx esta vacio siendo que los llamo de la misma manera.
Login.aspx
Código vb:
Ver original
Imports System.Data Imports System.Data.SqlClient Imports System.Configuration Imports System.Web.SessionState Partial Class peruLogin Inherits System.Web.UI.Page Protected Sub BtnEntrar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEntrar.Click Dim conectar As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim sqlconectar As SqlConnection = New SqlConnection(conectar) Dim cmd As SqlCommand = New SqlCommand("loginusuario", sqlconectar) cmd.CommandType = CommandType.StoredProcedure cmd.Connection.Open() cmd.Parameters.Add("@idProveedor", SqlDbType.Char, 15).Value = txtNombre.Text cmd.Parameters.Add("@idpassProv", SqlDbType.Char, 15).Value = txtPassword.Text Try Dim dr As SqlDataReader = cmd.ExecuteReader If dr.Read Then lblresult.Text = txtNombre.Text Session("admin") = txtNombre.Text FormsAuthentication.RedirectFromLoginPage(txtNombre.Text, False) 'Response.Redirect("../ptsa/Default.aspx") Else lblresult.Text = "El Usuario no Existe" End If Catch ex As Exception lblresult.Text = ex.Message End Try cmd.Connection.Close() End Sub End Class
Mismo codigo lo utilizo dos veces en dos paginas diferentes default.aspx y default2.aspx
Código ASP:
Ver original
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" > <asp:Label ID="plop" runat="server" Text="Label" Visible="True"></asp:Label> <ext:ResourceManager ID="ResourceManager1" runat="server" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [s_des_comentario] FROM [tb_cot_enc] where [s_rut_proveedor]=@Title" <selectparameters> <asp:controlparameter name="Title" controlid="plop" /> </selectparameters>
Código C++:
Ver original
using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Reflection; using System.Web.SessionState; public partial class ptsa_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string firstName = (string)(Session["admin"]); plop.Text = firstName; } }