Session Is Nothing when machine name mentioned in address bar
-
Hi Techies, I am very much surprised by the behaviour of the sessions. Let me explain them. I am retrieving the user name of the windows User by User.Identity and then saving it in a session. The once i click the login button, it should write as "Login Sucess". The Code Snippet is as follows :
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Try If Not Page.IsPostBack Then Session("UserID") = getLoginDomainUser() Me.txtUserID.Value = Session("UserID") End If Catch ex As Exception Me.lblstatus.InnerText = ex.Message End Try End Sub Private Sub btnLogin_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.ServerClick Try If Not Session("UserID") Is Nothing Then If Me.txtUserID.Value = Session("UserID").ToString Then Me.lblstatus.InnerText &= "Logged Successfully" Else Me.lblstatus.InnerText &= "Login Failed " End If End If Catch ex As Exception Me.lblstatus.InnerText = ex.Message End Try End Sub Private Function getLoginDomainUser() As String Dim strUser As String Try strUser = User.Identity.Name 'With Domain Name Catch ex As Exception Throw ex End Try End Function
I have created the msi file using setup and deployment project and then installed in the windows 2000 Server. The application works fine when i use the following url http://localhost//login.aspx or http:////login.aspx THE PROBLEM IS HERE when i give the machine name instead of ip , the session is getting empty and then i am not login The same setup is working fine with windows 2000 Professional. Can anybody tell me the reason for this peculair behaviour of the session I am hanging around this problem for more than 2 days . . . . Thanks in advance Sasidar