Is there a Session variable that identifies the session.

A

AAaron123

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
 
E

Eliyahu Goldin

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 said:
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
 
A

AAaron123

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
 
A

AAaron123

Mark said:
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
 
A

AAaron123

Mark said:
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?
 
J

Juan T. Llibre

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.





===============
 
A

AAaron123

Mark said:
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...
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
 
A

AAaron123

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
 
A

AAaron123

AAaron123 said:
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
 
M

Marvin Landman

AAaron123 said:
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
 
A

AAaron123

Marvin said:
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
 
M

Marvin Landman

For example consider this:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top