Session problem

Discussion in 'ASP .Net' started by Uzi Baruch, Dec 29, 2003.

  1. Uzi Baruch

    Uzi Baruch Guest

    Hi!



    Is there an embedded way to check if a session ends?



    i have an standard ASP.NET application and i want to check if the session
    has expired on every "Click" that the user did, and force him to login when
    the session no longer exists.



    Thanks,

    Uzi
    Uzi Baruch, Dec 29, 2003
    #1
    1. Advertising

  2. Uzi Baruch

    Hans Kesting Guest

    "Uzi Baruch" <> wrote in message
    news:...
    > Hi!
    >
    >
    >
    > Is there an embedded way to check if a session ends?
    >
    >
    >
    > i have an standard ASP.NET application and i want to check if the session
    > has expired on every "Click" that the user did, and force him to login

    when
    > the session no longer exists.
    >
    >
    >
    > Thanks,
    >
    > Uzi
    >


    There is a Session.IsNewSession property, but simpler would be to store the
    login-status
    in some session-variable and redirect to your login-page if that variable
    does not exist.

    Hans Kesting
    Hans Kesting, Dec 29, 2003
    #2
    1. Advertising

  3. Uzi Baruch

    Uzi Baruch Guest

    But that requires me to check it all the time, and that’s what I’m trying to
    avoid.



    i need something generic, built in the page, I thought of inheriting all the
    pages from my own page, and on the base page load the is the session ended,
    does that sound like a good idea ?



    Thanks,

    Uzi







    "Hans Kesting" <> wrote in message
    news:...
    >
    > "Uzi Baruch" <> wrote in message
    > news:...
    > > Hi!
    > >
    > >
    > >
    > > Is there an embedded way to check if a session ends?
    > >
    > >
    > >
    > > i have an standard ASP.NET application and i want to check if the

    session
    > > has expired on every "Click" that the user did, and force him to login

    > when
    > > the session no longer exists.
    > >
    > >
    > >
    > > Thanks,
    > >
    > > Uzi
    > >

    >
    > There is a Session.IsNewSession property, but simpler would be to store

    the
    > login-status
    > in some session-variable and redirect to your login-page if that variable
    > does not exist.
    >
    > Hans Kesting
    >
    >
    Uzi Baruch, Dec 29, 2003
    #3
  4. Uzi Baruch

    Hans Kesting Guest

    In web.config there is an <authentication> section that you could use.
    Sorry, I have never used that so I can't help you further.

    Hans Kesting

    "Uzi Baruch" <> wrote in message
    news:...
    > But that requires me to check it all the time, and that's what I'm trying

    to
    > avoid.
    >
    >
    >
    > i need something generic, built in the page, I thought of inheriting all

    the
    > pages from my own page, and on the base page load the is the session

    ended,
    > does that sound like a good idea ?
    >
    >
    >
    > Thanks,
    >
    > Uzi
    >
    >
    >
    >
    >
    >
    >
    > "Hans Kesting" <> wrote in message
    > news:...
    > >
    > > "Uzi Baruch" <> wrote in message
    > > news:...
    > > > Hi!
    > > >
    > > >
    > > >
    > > > Is there an embedded way to check if a session ends?
    > > >
    > > >
    > > >
    > > > i have an standard ASP.NET application and i want to check if the

    > session
    > > > has expired on every "Click" that the user did, and force him to login

    > > when
    > > > the session no longer exists.
    > > >
    > > >
    > > >
    > > > Thanks,
    > > >
    > > > Uzi
    > > >

    > >
    > > There is a Session.IsNewSession property, but simpler would be to store

    > the
    > > login-status
    > > in some session-variable and redirect to your login-page if that

    variable
    > > does not exist.
    > >
    > > Hans Kesting
    > >
    > >

    >
    >
    Hans Kesting, Dec 29, 2003
    #4
  5. > i have an standard ASP.NET application and i want to check if the session
    > has expired on every "Click" that the user did, and force him to login

    when
    > the session no longer exists.


    In your case, it's a simple matter of setting a Session variable when the
    user fills out the login page successfully. All you have to do is check for
    the existence of that Session variable. If it doesn't exist, the user has to
    log in.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "Uzi Baruch" <> wrote in message
    news:...
    > Hi!
    >
    >
    >
    > Is there an embedded way to check if a session ends?
    >
    >
    >
    > i have an standard ASP.NET application and i want to check if the session
    > has expired on every "Click" that the user did, and force him to login

    when
    > the session no longer exists.
    >
    >
    >
    > Thanks,
    >
    > Uzi
    >
    >
    >
    >
    >
    >
    Kevin Spencer, Dec 29, 2003
    #5
  6. You should think about forms authentication. it will redirect your user to
    login page automatically when the session is expired. Only thing is you need
    to play with the timeout value forms auth cookie and session timeout. For
    more details about forms authentication check out this link
    http://www.extremeexperts.com/Net/CodeSnippets/FormAuthentication.aspx

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "Kevin Spencer" <> wrote in message
    news:...
    > > i have an standard ASP.NET application and i want to check if the

    session
    > > has expired on every "Click" that the user did, and force him to login

    > when
    > > the session no longer exists.

    >
    > In your case, it's a simple matter of setting a Session variable when the
    > user fills out the login page successfully. All you have to do is check

    for
    > the existence of that Session variable. If it doesn't exist, the user has

    to
    > log in.
    >
    > --
    > HTH,
    > Kevin Spencer
    > .Net Developer
    > Microsoft MVP
    > Big things are made up
    > of lots of little things.
    >
    > "Uzi Baruch" <> wrote in message
    > news:...
    > > Hi!
    > >
    > >
    > >
    > > Is there an embedded way to check if a session ends?
    > >
    > >
    > >
    > > i have an standard ASP.NET application and i want to check if the

    session
    > > has expired on every "Click" that the user did, and force him to login

    > when
    > > the session no longer exists.
    > >
    > >
    > >
    > > Thanks,
    > >
    > > Uzi
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
    Saravana [MVP], Dec 31, 2003
    #6
    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. Andreas Klemt
    Replies:
    1
    Views:
    441
    Steve C. Orr, MCSD
    Jul 23, 2003
  2. shamanthakamani
    Replies:
    1
    Views:
    3,462
    Natty Gur
    Nov 20, 2003
  3. Jeff Smythe
    Replies:
    3
    Views:
    1,217
    Jeff Smythe
    Jan 2, 2004
  4. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,236
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  5. Jazzis
    Replies:
    2
    Views:
    227
    Jazzis
    Sep 23, 2003
Loading...

Share This Page