1

So today I stumped with an interesting problem: whenever I change the content of a C# web control (ascx) it doesn't display the new content until I recreate the entire website in IIS again. Even if I delete my .ascx file it doesn't matter. This has never happened to me before.

My goal is: to see the new .ascx content as soon as I change it.

Here's what I've tried :

  • Changing a line of the web.config
  • Restarting iis with iisreset.
  • Deleting temporary asp.net files
  • Restarting the application pool
  • Turning precompilation OFF
  • Placing this lines on the .cs's Page_Load event of the ascx:
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();

I'm assuming that there's a simple way to delete this cache of the .ascx files?

Thanks a lot!

Gaspa79
  • 5,488
  • 4
  • 40
  • 63
  • 1
    It sounds to me like you're pre-compiling your ASCX files. – Mike Perrenoud Aug 29 '13 at 18:08
  • 3
    http://stackoverflow.com/questions/10325928/how-might-one-turn-off-precompilation-in-iis – Mike Perrenoud Aug 29 '13 at 18:13
  • Thanks! Apparently that wasn't my problem though, cause I set it to false and nothing happened (both the site and IIS options, I also placed the option in the web.config). – Gaspa79 Aug 29 '13 at 18:21
  • 1
    what do you mean by "create the entire website"? rebuilding it? do your ascx files have ascx.cs/vb counterparts? do you have a bin directory? if so, what is in it? – mikey Aug 29 '13 at 18:42
  • Create the entire website means that I have to delete the IIS website (not the actual physical path though, just the IIS entry) and create it again on IIS (make the binds again, assign the app pool, assign the physical path). For some reason this makes the ascx display the new content. Yes, there is a bin directory and I have the .bin of my ascx control there. Thanks! – Gaspa79 Aug 29 '13 at 18:47
  • 2
    Have you tried, instead of deleting the site from IIS, just deleting all the contents of the Bin folder and re-deploying that? (also, don't forget to [use "@" notifications](http://meta.stackexchange.com/questions/43019/how-do-comment-replies-work) to respond to people. Otherwise they won't see it) – Josh Darnell Aug 29 '13 at 18:55
  • 1
    For some reason that worked. Thanks a lot!!! hahahaha – Gaspa79 Aug 29 '13 at 18:59
  • 1
    Well. If you use codebehind for your ASCX files, they get compiled into the DLLs in those Bin folders. So if you just publish the updated ascx file (and not the updated DLLs), you won't actually get all the updates. Make sense? – Josh Darnell Aug 29 '13 at 19:10

1 Answers1

0

Deleting the .bin and redeploying that worked for some reason.

Gaspa79
  • 5,488
  • 4
  • 40
  • 63