Jump to content

Global.asax C# script

- - - - -

  • Please log in to reply
1 reply to this topic

#1
nikodz

nikodz

    Newbie

  • Members
  • PipPip
  • 12 posts
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.

#2
nikodz

nikodz

    Newbie

  • Members
  • PipPip
  • 12 posts
I did what I wanted.
If someone know better algorithm, I'll be glade to post it.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users