For the most part your code seems to work fine, I was able to
authenticate, and see the session variable "UserID" on the landing
page.

I did change a couple of things...
        Dim strAuthenticationType = Context.User.Identity.AuthenticationType

        If Context.User.Identity.AuthenticationType = "Negotiate" Then
            Dim ChkAuthenticate As WindowsPrincipal = New
WindowsPrincipal(WindowsIdentity.GetCurrent)
            If ChkAuthenticate.Identity.Name <> "" And
ChkAuthenticate.Identity.IsAuthenticated = True Then
                Session("UserId") =
Request.ServerVariables("LOGON_USER").Split("\\")(1)
                Response.Redirect("HorzMenu.aspx", False)
            ElseIf ChkAuthenticate.Identity.IsAuthenticated = False Then
                'redirect to displayerror page
               
Response.Redirect("AccessControl/frmdisplayerrorpage.aspx?InvalidLogin="
& 10)
            End If
        End If

Instead of reading an authentication type from an appsetting in the
config file, I read it directly from the current user identity, notice
it is not Windows, but Negotiate, despite what the web.config says

<authentication mode="Windows" /> 

The other thing you have to make sure of, is that you are denying
anonymous users so that the app will authenticate.  This can be set in
the web.config

 <authorization>
        <deny users="?" />
</authorization>

If you are sure you are setting the session variable on this page, but
still getting nothing in the landing page, I would bet it is because
the landing page belongs to another web application.  have you set up
AccessControl as its own web app?  If so, it would not have access to
the session values set in the app that holds your login page.

On 6/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi Dean Fiala
> 
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> strAuthenticationType =
> System.Configuration.ConfigurationSettings.AppSettings("AuthenticationType")
> 
> If strAuthenticationType = "Windows" Then
>   Dim ChkAuthenticate As WindowsPrincipal = New
> WindowsPrincipal(WindowsIdentity.GetCurrent)
>   If ChkAuthenticate.Identity.Name <> "" And
> ChkAuthenticate.Identity.IsAuthenticated = True Then
>      Session("UserId") =
> Request.ServerVariables("LOGON_USER").Split("\\")(1)
>      Response.Redirect("AccessControl/frmDashBoard.aspx", False)
>   ElseIf ChkAuthenticate.Identity.IsAuthenticated = False Then
>      'redirect to displayerror page
>  Response.Redirect("AccessControl/frmdisplayerrorpage.aspx?InvalidLogin="
> & 10)
>   End If
> End If
> End Sub
> 
> In the above code if the  strAuthenticationType is not "Windows" then
> login page is loaded to
> accept user id and password
> 
> 
> 
> 
> 
> 
> Dean Fiala <[EMAIL PROTECTED]>
> Sent by: [email protected]
> 06/28/2005 06:21 PM
> Please respond to AspNetAnyQuestionIsOk
> 
>        To:     [email protected]
>        cc:
>        Subject:        Re: [AspNetAnyQuestionIsOk] Session Variable
> 
> 
> Post your code
> 
> On 6/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Iam redirect the user from Page Load event of Login Page to
> > main menu page based on some criteria.
> >
> > In the Page Load event of Login Page iam Initializing session variables
> > but when i move to the main menu all the seesion values are  null.
> >
> > Can any one help me on this?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > [EMAIL PROTECTED]
> > Sent by: [email protected]
> > 06/28/2005 10:48 AM
> > Please respond to AspNetAnyQuestionIsOk
> >
> >         To:     [email protected]
> >         cc:
> >         Subject:        [AspNetAnyQuestionIsOk] Session Variable
> >
> >
> > Hi,
> >
> > Iam Initializing a  session values in my login page.After authenicating
> > the users, I will write the user details to audit table and redirect to
> my
> >
> > main menu page. In the menu page's Load event Iam checking the suerid i
> > stored in the session
> > variable. It is saying "Nothing". All the session values become Null.
> > Why??
> >
> > Regards
> > Ravi
> >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> 
> 
> --
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 


-- 
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to