Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.Net Session Timeout after deleting a directory 1

Status
Not open for further replies.

jupiter8

Programmer
Nov 22, 2002
72
0
0
GB
I know this is a strange request, but I'm going nuts trying to figure out why my session is terminated the moment I either delete or move a folder via code using system.io.directory or system.io.directoryinfo objects.

I'm trying to allow users to add, edit the names of and remove physical directories within the website. This will then be used with some file upload code. The session variable works across the entire site until the user either deletes or renames(moves)a directory.

Here is the snippet of code used to delete a directory, if this is commented out the page runs without terminating the session, otherwise running this kills it.

Dim dDirInfo As IO.DirectoryInfo
dDirInfo = New System.IO.DirectoryInfo(s_Physical_Path)

dDirInfo.Exists = True Then dDirInfo.Delete()
dDirInfo = Nothing

The code works fine and does exactly what I intended it to do, but obviously I'm doing something really bad here. Please put me out of my misery and tell me what an idot I've been, and if at all possibel why?

 
What directory are you deleting and what are it's contents?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I have created a directory called 'uploads' with another couple of directories for images and documents called 'images' and 'docs'.

Within the 'images' sub folder I allow the user to create as many sub-directories as they like to store their images in.

I have granted the images folder and all its sub-folders the necessary permissions and as far as that goes it all works well. In fact creating new directories works just fine and does not terminate the session.
 
Hmmm...by the sounds of your original question, I was thinking that you may have been deleting (or modifying) something that causes the application to get recompiled.

When you say you are deleting the folders, are you deleting the actual images folder ot just the sub-folders that the user has created?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
No just the sub folder. The user has no ability to ever delete or modify the 'image' folder. Nor can they store any files in it. They need to create a sub folder before they can add any files.

Personally I just assumed that I was doing something really stupid as I'm still relatively new to ASP.Net especially ASP.Net 2 which this is written in.
 
I don't think you are doing anything out of the ordinary but it does seem to be triggering the end of a session (for example, if you modified the web.config file you'd notice the same scenario).

All I can think of, is that:

1) The initial file structure of the website is being altered (which you have said it isn't)
2) Another piece of code is triggering the app to be recompiled (like in my example about the web.config file)


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Would you just clarify what you mean by the initial file struture of the website is being altered.

I've included the uploads/images folders in the project in Visual Studio is that what you mean?
 
Well, for example, if a change occurs in the App_Code directory, ASP.NET will dynamically recompile these classes and automatically make it available to all the pages in the web site - It could be doing the same for your images folders.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
It has to be something along these lines. Although there doesn't appear to be any way to exclude folders from a project in the same wasy that you can exclude files.

Thanks for all your help, this at least gives me some further ideas to research.
 
Although there doesn't appear to be any way to exclude folders from a project in the same wasy that you can exclude files.
Tell me about it! That's been the one big stumbling block that I've had so far in VS2005. You can see my post about it here.

As aa solution, if you create the images folder outside of the existing structure of the website, you shouldn't have this problem.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks but that no use in my case as the folders need to be in the website otherwise the client can't use the images that they have just added
 
I am having this same problem. Did you find a good solution for this? Can you put some other web.config file in the folder, to prevent it from reseting the session?
 
My inital reponse of:
As aa solution, if you create the images folder outside of the existing structure of the website, you shouldn't have this problem.
could still be a valid solution. Although the original poster said:
Thanks but that no use in my case as the folders need to be in the website otherwise the client can't use the images that they have just added
that will only be true if you don't setup the other directory to be a virtual directory in IIS. If you do, then it will work as required.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top