Newbie to ASP.Net

Discussion in 'ASP General' started by Xarky, Mar 26, 2005.

  1. Xarky

    Xarky Guest

    Hi,
    I am writing a small application and I am facing the 2 following
    problems.

    1)
    I have implemented an authentication screen (simple username and
    password), and when user signs in, I use the following and redirect
    user to a main page
    Session["connected"] = username;

    When user tries to visit the main page, without first having signed
    in, in the Page_Load, I check the value of the Session["connected"]
    and if its empty, I redirect user back to authentication screen.

    Now when user signs out, Session["connected"] is set "" and user is
    redirected to authentication screen.

    When user have at leasted visted main page once in authenticated
    state, and then in non-authenticated state, he tries again to visit
    the main page, he is not being directed to authentication screen, but
    entering main page normally. I tried to do some debugging in the
    method Page_Load, but at the time descrived in this paragraph, it is
    not entering in this method.

    Is there any other method that I should handle/overload?


    2)
    I have followed this link to do a drop-down menu:
    http://msdn.microsoft.com/library/d...ta/html/OfficeFrontPageCreateDropDownMenu.asp

    Now one of the menu Items is Sign Out. In this Sign out I have done a
    link to the Authentication screen described earlier. Now before I
    redirect the user I require to do some operations like
    Session["connected"] = "";

    Can this be done with some scripting. I have done something similar
    to this in another language, previously.


    I hope someone understands my problems and helps me out.
    Thanks in Advance
    Xarky, Mar 26, 2005
    #1
    1. Advertising

  2. There was no way for you to know it, but this is a classic asp newsgroup.
    While you may be lucky enough to find a dotnet-savvy person here who can
    answer your question, you can eliminate the luck factor by posting your
    question to a group where those dotnet-savvy people hang out. I suggest
    microsoft.public.dotnet.framework.aspnet.


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Mar 26, 2005
    #2
    1. Advertising

  3. Xarky

    B_O_B Guest

    Why not use forms authentication?

    "Alvin Bruney [ASP.NET MVP]" wrote:

    > for item # 1 you most likely are not verifying the value of the session
    > variable. In fact you should set it to null instead of an empty string so
    > then you can check like so
    > if(Session["ads"] == null)
    > redirect.
    >
    > I agree with bob, you should post this in the asp.net newsgroup to prevent
    > pollution.
    >
    > --
    > Regards,
    > Alvin Bruney
    > [Shameless Author Plug]
    > The Microsoft Office Web Components Black Book with .NET
    > available at www.lulu.com/owc
    > _________________________
    >
    >
    > "Xarky" <> wrote in message
    > news:...
    > > Hi,
    > > I am writing a small application and I am facing the 2 following
    > > problems.
    > >
    > > 1)
    > > I have implemented an authentication screen (simple username and
    > > password), and when user signs in, I use the following and redirect
    > > user to a main page
    > > Session["connected"] = username;
    > >
    > > When user tries to visit the main page, without first having signed
    > > in, in the Page_Load, I check the value of the Session["connected"]
    > > and if its empty, I redirect user back to authentication screen.
    > >
    > > Now when user signs out, Session["connected"] is set "" and user is
    > > redirected to authentication screen.
    > >
    > > When user have at leasted visted main page once in authenticated
    > > state, and then in non-authenticated state, he tries again to visit
    > > the main page, he is not being directed to authentication screen, but
    > > entering main page normally. I tried to do some debugging in the
    > > method Page_Load, but at the time descrived in this paragraph, it is
    > > not entering in this method.
    > >
    > > Is there any other method that I should handle/overload?
    > >
    > >
    > > 2)
    > > I have followed this link to do a drop-down menu:
    > > http://msdn.microsoft.com/library/d...ta/html/OfficeFrontPageCreateDropDownMenu.asp
    > >
    > > Now one of the menu Items is Sign Out. In this Sign out I have done a
    > > link to the Authentication screen described earlier. Now before I
    > > redirect the user I require to do some operations like
    > > Session["connected"] = "";
    > >
    > > Can this be done with some scripting. I have done something similar
    > > to this in another language, previously.
    > >
    > >
    > > I hope someone understands my problems and helps me out.
    > > Thanks in Advance

    >
    >
    >
    B_O_B, Mar 31, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Navin Mishra
    Replies:
    4
    Views:
    386
    =?Utf-8?B?UGVyc2hpbmc=?=
    Oct 20, 2006
  2. verci
    Replies:
    1
    Views:
    355
    Teemu Keiski
    Feb 12, 2007
  3. verci

    Newbie, error between asp.net 1.1 and asp.net 2.0

    verci, Feb 8, 2007, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    161
    Teemu Keiski
    Feb 12, 2007
  4. verci

    Newbie, error between asp.net 1.1 and asp.net 2.0

    verci, Feb 8, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    106
    Teemu Keiski
    Feb 12, 2007
  5. Navin Mishra
    Replies:
    1
    Views:
    107
    sonic
    Aug 25, 2006
Loading...

Share This Page