Session becomes nothing when machine address is given

S

sasidar.d

hi techies

I have created a Login web page . It gets the user identity using the
window nt authetication.
The page is working fine. I have removed the allow anonymous access
check box for the virtual directory and then given the check for the
integrated window authetication.

After deploying the project in the testing server - windows 2003 server
(server called as svr10) it is working fine.

But when deployed in the production server which has the same windows
2003 server with iis 6.0 i face the following problem

when i give the url as localhost followed by the virtualdirectory name
and login.aspx , the i am able to login in

But i am not able to login when i give the name of the machine instead
of localhost.

Similarly i am not able to login from the client system also. the
client system is windows 2000 professional with ie 6

After debugging the application i found that the session which i have
used to store the user identity is becoming nothing after post back

The sequence of my code is like this

1) Page load - I retrieve the user identity and store it in a session -
display the same user identity in the text box.
2) Button click event - i am checking for the session and then allowing
to log in, but it fails because the session is nothin

<code snippet>

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
Me.lblstatus.InnerText = "Post back occured "
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
Else
Me.lblstatus.InnerText &= "Session Empty "
End If

Catch ex As Exception
Me.lblstatus.InnerText = ex.Message
End Try
End Sub
Private Function getLoginDomainUser() As String
Dim strUser As String
Dim intPos As Int16
Try

strUser = User.Identity.Name 'With Domain Name

If strUser.Trim <> "" Then
Me.lblstatus.InnerText = Me.lblstatus.InnerText
intPos = Convert.ToInt16(InStr(strUser, "\"))
domainName = Mid(strUser, 1, intPos - 1)
loggedUser = Mid(strUser, intPos + 1)
getLoginDomainUser = loggedUser
Else
Throw New Exception(" Authenctication Not Set. Please
Contact Administrator ")
End If
Catch ex As Exception
Throw ex
End Try

End Function
<code snippet>

Not able to find the reason for this peculiar behaviour

Any help is highly appreciated


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top