AMB Posted February 28, 2012 Report Share Posted February 28, 2012 Boa Tarde Pessoal É o seguinte desenvolvi uma webapplication em vb, mas agora dei conta que se me logar como "xyz" no meu pc eu consigo entrar normalmente e vejo as coisas correspondentes ao xyz, mas se entretanto noutro pc me logar como "abc" eu que estava como "xyz" passo a ver tudo do "abc" e perco acesso ao que estava a ver.. Existe claramente um problema no login so não consigo perceber... tipo eu nas paginas seguintes ao login feito em default.aspx tenho que o logado vem de default.logado... ha algo de errado nisso?? Obrigado EDIT: Titulo do tópico alterado, não existem duvidas com prioridades difrentes aqui no P@P Link to comment Share on other sites More sharing options...
AMB Posted February 28, 2012 Author Report Share Posted February 28, 2012 Para que me possam ajudar melhor coloco aqui o codigo da pagina de login: Partial Public Class Log Inherits System.Web.UI.Page Public Shared ut1 As String Public Shared us As String Public Shared conne As String Public Shared ut As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load us = TextBox1.Text conne = "Data Source=\RH;Initial Catalog=Ferias;" Dim conn As New SqlConnection Dim comand As New SqlCommand conn.ConnectionString = conne conn.Open() comand.Connection = conn comand.CommandText = "SELECT Nome FROM Utilizadores WHERE Cod='" & us & "'" ut1 = comand.ExecuteScalar End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim conn As New SqlConnection Dim comand As New SqlCommand Dim senha As String Dim ut As String Dim ut6 As String conn.ConnectionString = conne conn.Open() Dim us As String us = TextBox1.Text comand.Connection = conn comand.CommandText = "SELECT Pass FROM Utilizadores WHERE Cod='" & us & "'" senha = comand.ExecuteScalar TextBox4.Text = senha.ToString conn.Close() conn.Open() comand.Connection = conn comand.CommandText = "SELECT Cod FROM Utilizadores WHERE Cod='" & us & "'" ut = comand.ExecuteScalar comand.Connection = conn comand.CommandText = "SELECT valid FROM Utilizadores WHERE Cod='" & us & "'" ut6 = comand.ExecuteScalar TextBox6.Text = ut6.ToString TextBox7.Text = TextBox3.Text.ToString If ((TextBox4.Text.Equals(TextBox3.Text)) And (TextBox6.Text.Equals("0"))) Then Response.Redirect("A.aspx") ElseIf ((TextBox4.Text.Equals(TextBox3.Text)) And (TextBox6.Text.Equals("1"))) Then Response.Redirect("Tabela.aspx") Else Response.Redirect("Log.aspx") End If End Sub e a pagina A.aspx pagina seguinte o que muda quando outro utilizador se loga consta na textbox 5 artial Public Class A Inherits System.Web.UI.Page Public Shared conne As String Public Shared nleitura As String Public Shared n As String Public Shared nleitura1 As String Public Shared n1 As String Public Shared res As Integer Public Shared res1 As Integer Public Shared rest As Integer Public Shared mais As Integer Public Shared k As Integer = 0 Public Shared cod As String Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load TextBox5.Text = Log.ut1 Link to comment Share on other sites More sharing options...
mjamado Posted February 28, 2012 Report Share Posted February 28, 2012 Até eu, que não trabalho em VB há 10 anos, vi logo a gralha. No entanto, não existem dúvidas "urgentes", e muito menos "URGENTES", no P@P. Por isso, aguentas aí mais um bocadinho, e podes ir olhando para as tuas declarações de variáveis enquanto esperas. "Para desenhar um website, não tenho que saber distinguir server-side de client-side" - um membro do fórum que se auto-intitula webdesigner. Temo pelo futuro da web. Link to comment Share on other sites More sharing options...
Caça Posted February 28, 2012 Report Share Posted February 28, 2012 Utiliza variaveis de sessão. Pedro Martins Não respondo a duvidas por PM Link to comment Share on other sites More sharing options...
AMB Posted February 29, 2012 Author Report Share Posted February 29, 2012 Obrigado por tudo, desconhecia o tipo de variaveis de sessao ? Mais uma vez obrigada Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now