Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session becomes nothing when machine address is given

Reply
Thread Tools

Session becomes nothing when machine address is given

 
 
sasidar.d@gmail.com
Guest
Posts: n/a
 
      03-10-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
re module: Nothing to repeat, but no sre_constants.error: nothing torepeat ? Devin Jeanpierre Python 2 02-14-2012 01:33 PM
and becomes or and or becomes and Stef Mientki Python 9 05-28-2011 02:04 PM
Reversing Bit Order.. i.e. MSB becomes bit 0, LSB becomes bit 15 benn686@hotmail.com C++ 9 08-22-2007 12:13 AM
RAM - 2gb becomes 4gb becomes 2gb b Computer Support 10 04-27-2006 11:58 PM



Advertisments