Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Global.asax C# script

asp.net

  • Please log in to reply
1 reply to this topic

#1 nikodz

nikodz

    CC Newcomer

  • Just Joined
  • PipPip
  • 12 posts

Posted 22 February 2011 - 04:53 AM

Hello.
First, I should say that I'm using ASP.NET and C#.
I needed to show image on the web, which is drawn by server.
So, I draw image using bitmap and graphics and save it in Server.MapPath(imagename).
Also, image is different from all clients and I'm generating different imagename.
when client go to the web page, image is generated, for example: imagename = "123.jpg";
After client click button, image is changed(Server draw new Image), and 123.jpg file is changed, but client see same image.
So I decided to generate image with other name like: "12345.jpg" and delete old "123.jpg"
But there is a problem. After client leave web page, image will not be deleted.
I am saving Image Name with Session. I know that global.asax (like global.asa) has session_end event. (I am using C#)
How can I delete file ( File.Delete(path + imagename) ) when Session_end? Or someone may have a better Idea.
  • 0

#2 nikodz

nikodz

    CC Newcomer

  • Just Joined
  • PipPip
  • 12 posts

Posted 22 February 2011 - 06:47 AM

I did what I wanted.
If someone know better algorithm, I'll be glade to post it.
  • 0





Also tagged with one or more of these keywords: asp.net

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download