Is there a Session variable that identifies the session.

Discussion in 'ASP .Net' started by AAaron123, Sep 6, 2009.

  1. AAaron123

    AAaron123 Guest

    Is there a Session variable that identifies the session.
    I need to generate a unique folder for each session and need a unique name.
    At the end of the session I need to delete it.

    Is there such a thing as a folder/file in memory?

    Thanks
     
    AAaron123, Sep 6, 2009
    #1
    1. Advertising

  2. AAaron123

    Daniel Ulfe Guest

    Daniel Ulfe, Sep 6, 2009
    #2
    1. Advertising

  3. Session.SessionID.

    Why don't you store the data you want to be in memory in session itself?


    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://blogs.microsoft.co.il/blogs/egoldin
    http://msmvps.com/blogs/egoldin


    "AAaron123" <> wrote in message
    news:%...
    > Is there a Session variable that identifies the session.
    > I need to generate a unique folder for each session and need a unique
    > name.
    > At the end of the session I need to delete it.
    >
    > Is there such a thing as a folder/file in memory?
    >
    > Thanks
    >
    > __________ Information from ESET NOD32 Antivirus, version of virus
    > signature database 4400 (20090906) __________
    >
    > The message was checked by ESET NOD32 Antivirus.
    >
    > http://www.eset.com
    >
    >
    >



    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4400 (20090906) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com
     
    Eliyahu Goldin, Sep 6, 2009
    #3
  4. AAaron123

    AAaron123 Guest

    I know I asked but I'm not really sure it would make sense anyway.

    I have image files in a database and need to copy them to a folder because
    ajaxToolkit:SlideShowExtender requires a folder.

    Not having to deal with a phyical folder would be nice but maybe using
    memory doesn't make sense for such files?

    In any event, it would have to look like a folder to
    ajaxToolkit:SlideShowExtender (I think).

    Thanks


    Eliyahu Goldin wrote:
    > Session.SessionID.
    >
    > Why don't you store the data you want to be in memory in session
    > itself?
    >
    >
    > "AAaron123" <> wrote in message
    > news:%...
    >> Is there a Session variable that identifies the session.
    >> I need to generate a unique folder for each session and need a unique
    >> name.
    >> At the end of the session I need to delete it.
    >>
    >> Is there such a thing as a folder/file in memory?
    >>
    >> Thanks
    >>
    >> __________ Information from ESET NOD32 Antivirus, version of virus
    >> signature database 4400 (20090906) __________
    >>
    >> The message was checked by ESET NOD32 Antivirus.
    >>
    >> http://www.eset.com
    >>
    >>
    >>

    >
    >
    > __________ Information from ESET NOD32 Antivirus, version of virus
    > signature database 4400 (20090906) __________
    > The message was checked by ESET NOD32 Antivirus.
    >
    > http://www.eset.com
     
    AAaron123, Sep 6, 2009
    #4
  5. AAaron123

    AAaron123 Guest

    Thanks

    Daniel Ulfe wrote:
    > Session.SessionID
    >
    > http://msdn.microsoft.com/en-us/library/ms524326.aspx
    >
    >
    > You can create/delete your folder using the Global.asax file.
    >
    > http://msdn.microsoft.com/en-us/library/2027ewzw.aspx
    >
    >
    > Daniel.
    >
    > AAaron123 wrote:
    >> Is there a Session variable that identifies the session.
    >> I need to generate a unique folder for each session and need a
    >> unique name. At the end of the session I need to delete it.
    >>
    >> Is there such a thing as a folder/file in memory?
    >>
    >> Thanks
     
    AAaron123, Sep 6, 2009
    #5
  6. AAaron123

    AAaron123 Guest

    Mark Rae [MVP] wrote:
    > "AAaron123" <> wrote in message
    > news:%...
    >
    >> Is there a Session variable that identifies the session.

    >
    > In addition to the existing responses, bear in mind that when a user
    > closes their browser or navigates away from your web app, this does
    > *NOT* tear down their session...
    >
    > Unless you provide a "log out" button and can rely on your users to
    > actually click it, the session will expire when it times out (after a
    > default value of 20 minutes) and not before.


    Thanks
     
    AAaron123, Sep 6, 2009
    #6
  7. AAaron123

    AAaron123 Guest

    Mark Rae [MVP] wrote:
    > "AAaron123" <> wrote in message
    > news:%...
    >
    >> Is there a Session variable that identifies the session.

    >
    > In addition to the existing responses, bear in mind that when a user
    > closes their browser or navigates away from your web app, this does
    > *NOT* tear down their session...
    >
    > Unless you provide a "log out" button and can rely on your users to
    > actually click it, the session will expire when it times out (after a
    > default value of 20 minutes) and not before.


    I do not require the user to login.

    For testing I would like to have the server end the session when I click a
    button.
    Not 20 minutes after I leave.

    Same for the application.

    Can I do that?
     
    AAaron123, Sep 10, 2009
    #7
  8. re:
    !> For testing I would like to have the server end the session when I click a button.
    !> Not 20 minutes after I leave.

    To do that, call Session.Abandon.

    Be forewarned, though, that most users will *not* click the button to exit your app.





    Juan T. Llibre, asp.net MVP
    ¿ Estas probando VS 2010 y ASP.NET 4.0 ?
    Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
    http://asp.net.do/foros/forums/
    =====================================================
    "AAaron123" <> wrote in message news:...
    > Mark Rae [MVP] wrote:
    >> "AAaron123" <> wrote in message
    >> news:%...
    >>
    >>> Is there a Session variable that identifies the session.

    >>
    >> In addition to the existing responses, bear in mind that when a user
    >> closes their browser or navigates away from your web app, this does
    >> *NOT* tear down their session...
    >>
    >> Unless you provide a "log out" button and can rely on your users to
    >> actually click it, the session will expire when it times out (after a
    >> default value of 20 minutes) and not before.

    >
    > I do not require the user to login.
    >
    > For testing I would like to have the server end the session when I click a button.
    > Not 20 minutes after I leave.
    >
    > Same for the application.
    >
    > Can I do that?
     
    Juan T. Llibre, Sep 10, 2009
    #8
  9. AAaron123

    AAaron123 Guest

    I show the button only for me.
    So I can test my Session End code.

    Thanks


    Juan T. Llibre wrote:
    > re:
    > !> For testing I would like to have the server end the session when I
    > click a button. !> Not 20 minutes after I leave.
    >
    > To do that, call Session.Abandon.
    >
    > Be forewarned, though, that most users will *not* click the button to
    > exit your app.
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > ¿ Estas probando VS 2010 y ASP.NET 4.0 ?
    > Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
    > http://asp.net.do/foros/forums/
    > =====================================================
    > "AAaron123" <> wrote in message
    > news:...
    >> Mark Rae [MVP] wrote:
    >>> "AAaron123" <> wrote in message
    >>> news:%...
    >>>
    >>>> Is there a Session variable that identifies the session.
    >>>
    >>> In addition to the existing responses, bear in mind that when a user
    >>> closes their browser or navigates away from your web app, this does
    >>> *NOT* tear down their session...
    >>>
    >>> Unless you provide a "log out" button and can rely on your users to
    >>> actually click it, the session will expire when it times out (after
    >>> a default value of 20 minutes) and not before.

    >>
    >> I do not require the user to login.
    >>
    >> For testing I would like to have the server end the session when I
    >> click a button. Not 20 minutes after I leave.
    >>
    >> Same for the application.
    >>
    >> Can I do that?
     
    AAaron123, Sep 10, 2009
    #9
  10. AAaron123

    AAaron123 Guest

    Mark Rae [MVP] wrote:
    > "AAaron123" <> wrote in message
    > news:...
    >
    >>>> Is there a Session variable that identifies the session.
    >>>
    >>> In addition to the existing responses, bear in mind that when a user
    >>> closes their browser or navigates away from your web app, this does
    >>> *NOT* tear down their session...
    >>>
    >>> Unless you provide a "log out" button and can rely on your users to
    >>> actually click it, the session will expire when it times out (after
    >>> a default value of 20 minutes) and not before.

    >>
    >> I do not require the user to login.

    >
    > So what's the point of all this, other than to create problems for
    > yourself...?


    web masters can login to update event calendar and photo albums...

    >
    >
    >> For testing I would like to have the server end the session when I
    >> click a button. > Not 20 minutes after I leave.

    >
    > http://msdn.microsoft.com/en-us/library/ms524310.aspx
    >
    > But, as previously stated, this is totally reliant on your users
    > clicking the button... If they don't for whatever reason (e.g. they
    > simply close their browser or nagivate away from your site), the
    > session will remain until it times out naturally...


    I show the button only for me.
    So I can test my Session End code.

    Thanks

    >
    >
    >> Same for the application.

    >
    > The application quits when the last active session ends - you don't
    > really have much control over that...
     
    AAaron123, Sep 10, 2009
    #10
  11. AAaron123

    AAaron123 Guest

    It's a good thing I tested my Session_End code.

    Seems I can not use: Server.MapPath("~/Tmp.Zip")
    because: Server operation is not available in this context.

    That is in Global.asax - Session_End

    I can't hard code for ~ because it's different on the dev system and the
    host.



    What to do?

    Thanks
     
    AAaron123, Sep 10, 2009
    #11
  12. AAaron123

    AAaron123 Guest

    AAaron123 wrote:
    > It's a good thing I tested my Session_End code.
    >
    > Seems I can not use: Server.MapPath("~/Tmp.Zip")
    > because: Server operation is not available in this context.
    >
    > That is in Global.asax - Session_End
    >
    > I can't hard code for ~ because it's different on the dev system and
    > the host.
    >
    >
    >
    > What to do?
    >
    > Thanks


    HttpRuntime.AppDomainAppPath

    Seems to work.

    Is there a difference in the definitions of the paths:
    HttpRuntime.AppDomainAppPath and "~"



    Thanks
     
    AAaron123, Sep 10, 2009
    #12
  13. AAaron123 wrote:
    > HttpRuntime.AppDomainAppPath
    >
    > Seems to work.
    >
    > Is there a difference in the definitions of the paths:
    > HttpRuntime.AppDomainAppPath and "~"


    MapPath has the advantage that it can handle situations when the virtual
    directory layout is different from the physical one.

    As long as you don't have virtual subdirectories inside your application
    you can safely use HttpRuntime.AppDomainAppPath.

    For example consider this:
    http://server/myapp/sales/default.aspx ->
    C:\wwwroot\myapp\sales\default.aspx

    http://server/myapp/support/contact.aspx -> C:\myapp_support\file.aspx

    Marvin
     
    Marvin Landman, Sep 10, 2009
    #13
  14. AAaron123

    AAaron123 Guest

    Marvin Landman wrote:
    > AAaron123 wrote:
    >> HttpRuntime.AppDomainAppPath
    >>
    >> Seems to work.
    >>
    >> Is there a difference in the definitions of the paths:
    >> HttpRuntime.AppDomainAppPath and "~"

    >
    > MapPath has the advantage that it can handle situations when the
    > virtual directory layout is different from the physical one.
    >
    > As long as you don't have virtual subdirectories inside your
    > application you can safely use HttpRuntime.AppDomainAppPath.
    >
    > For example consider this:
    > http://server/myapp/sales/default.aspx ->
    > C:\wwwroot\myapp\sales\default.aspx
    >
    > http://server/myapp/support/contact.aspx -> C:\myapp_support\file.aspx
    >
    > Marvin


    I very much want to understand this.
    Could you add a few words of explination to your examples?
    In the first example the virtual directoty.....
    Whareas in the second example....


    Thanks
     
    AAaron123, Sep 11, 2009
    #14
  15. >> For example consider this:
    >> http://server/myapp/sales/default.aspx ->
    >> C:\wwwroot\myapp\sales\default.aspx
    >>
    >> http://server/myapp/support/contact.aspx -> C:\myapp_support\file.aspx
    >>

    > I very much want to understand this.
    > Could you add a few words of explination to your examples?
    > In the first example the virtual directoty.....
    > Whareas in the second example....


    Go to IIS manager: If you right click on the web site or any physical or
    virtual directory below the web site in the tree you can add new virtual
    directories that can physically be located somewhere else don't have to
    be physically located under their virtual parent.

    I the above example of paths if myapp is your app then "support" will
    not be physically located under HttpRuntime.AppDomainAppPath but if you
    know that no virtual directories are interfering with your
    HttpRuntime.AppDomainAppPath based solution the you can safely use
    HttpRuntime.AppDomainAppPath.

    Marvin
     
    Marvin Landman, Sep 11, 2009
    #15
    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. Replies:
    1
    Views:
    1,095
    Bruce Barker
    Nov 14, 2005
  2. Mohanasundaram
    Replies:
    44
    Views:
    1,108
    Keith Thompson
    Aug 24, 2004
  3. mfglinux
    Replies:
    11
    Views:
    751
    Roberto Bonvallet
    Sep 12, 2007
  4. chowchho
    Replies:
    7
    Views:
    662
    Patrice
    Mar 28, 2008
  5. stec00
    Replies:
    20
    Views:
    822
    Jeremy J Starcher
    Jun 23, 2009
Loading...

Share This Page