Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am generating a sitemap in asp.net c# web app.
I am using temp file and then extract all the data to sml file and mail it to my id

but when i try to use it in 2 diff browsers at same time, one browser shows me the above error...

provide me solution.
Posted
Comments
Estys 6-Jul-10 12:27pm    
A random number might not be enough. Are you sure you don't seed your random number generator with the same seed?
A look at your code generating (and disposing of) the filename would help.
Don't look for my answer too soon though, the match between Netherlands-Urugay starts soon and I'm watching it!

Your problem is that your code is broken and you don't really understand how the internet works. You are opening a file in one thread for one user, and then it's locked when another thread tries to open it. So, fix your code. We can't tell you how, you didn't post it, but it involves closing the file, or creating unique temp files each time you need them.
 
Share this answer
 
If your using a temporary file, you should generate a unique (file)name for every request for this data, otherwise you will keep running into the problem.

Cheers
 
Share this answer
 
Comments
ashu2188 6-Jul-10 7:22am    
I fixed my code and i got the solution but 1 problem remains is just that every time the first temp file gets deleted and other temp files remains.
Well thats not an issue for me but if any one can help me to solve this, my code will be more robust.

@Estys :

And Every temp file gets generated with a random number so that unique no is not an issue for me

Thank you.
Ashutosh Jain.
Estys 6-Jul-10 12:25pm    
A random number might not be enough. Are you sure you don't seed your random number generator with the same seed?
A look at your code generating (and disposing of) the filename would help.
Don't look for my answer too soon though, the match between Netherlands-Urugay starts soon and I'm watching it!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900