asp.net caching:
Hello. I just discovered this method and tried it out. It seems that the CodeFile (.aspx.vb) is not considered a dependency; yet, if I chose to have that same code in the .aspx page, altering it would change the Last-Modified value. Is this considered a bug? Cordially, Lee C.
Nope, that's by design if I understand you correctly. It seems that the [quoted text, click to view] > CodeFile (.aspx.vb) is not considered a dependency;
Where did you get this info from? -- -- Regards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The O.W.C. Black Book, 2nd Edition Exclusively on www.lulu.com/owc $19.99 [quoted text, click to view] "Lee C." <nomail@spam.com> wrote in message news:ezCfmslhIHA.4320@TK2MSFTNGP06.phx.gbl... > Hello. I just discovered this method and tried it out. It seems that the > CodeFile (.aspx.vb) is not considered a dependency; yet, if I chose to > have that same code in the .aspx page, altering it would change the > Last-Modified value. > > Is this considered a bug? > > Cordially, > Lee C.
Thanks for the reply, Alvin. I got that info from watching the HTTP requests, in detail, with Fiddler2 ( http://www.fiddlertool.com/fiddler/). IMO, the design is flawed. The CodeFile can alter the presentation; thus, it should be considered when determining the Last-Modified. If I put the presentation altering code in the .aspx page inside script delimiters, when I save the file, it would affect the Last-Modified. If I take that same code and put it in the CodeFile and save it, the save does not affect the Last-Modified. That is illogical. Cordially, Lee C. [quoted text, click to view] "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message news:51EE9819-C16F-448C-A714-E67D57F1855C@microsoft.com... > Nope, that's by design if I understand you correctly. > > It seems that the >> CodeFile (.aspx.vb) is not considered a dependency; > Where did you get this info from? > > -- > -- > Regards, > Alvin Bruney [MVP ASP.NET] > > [Shameless Author plug] > The O.W.C. Black Book, 2nd Edition > Exclusively on www.lulu.com/owc $19.99 > > > "Lee C." <nomail@spam.com> wrote in message > news:ezCfmslhIHA.4320@TK2MSFTNGP06.phx.gbl... >> Hello. I just discovered this method and tried it out. It seems that >> the CodeFile (.aspx.vb) is not considered a dependency; yet, if I chose >> to have that same code in the .aspx page, altering it would change the >> Last-Modified value. >> >> Is this considered a bug? >> >> Cordially, >> Lee C. >>
Ok, I understand what you are saying - to rephrase, the dependency on the aspx file works but the dependency on the codebehind file does not work, right? The code beside files is of absolutely no use to the run-time, why should there be a dependency on it? The contents of the file is compiled into binary and placed in a temp location. Access to the types which were defined in the file is occuring thru that temp binary at run-time - the code file plays no part point forward. -- -- Regards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The O.W.C. Black Book, 2nd Edition Exclusively on www.lulu.com/owc $19.99 [quoted text, click to view] "Lee C." <nomail@spam.com> wrote in message news:O3zd19whIHA.5208@TK2MSFTNGP04.phx.gbl... > Thanks for the reply, Alvin. I got that info from watching the HTTP > requests, in detail, with Fiddler2 ( http://www.fiddlertool.com/fiddler/). > > IMO, the design is flawed. The CodeFile can alter the presentation; thus, > it should be considered when determining the Last-Modified. > > If I put the presentation altering code in the .aspx page inside script > delimiters, when I save the file, it would affect the Last-Modified. If I > take that same code and put it in the CodeFile and save it, the save does > not affect the Last-Modified. That is illogical. > > Cordially, > Lee C. > > > "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message > news:51EE9819-C16F-448C-A714-E67D57F1855C@microsoft.com... >> Nope, that's by design if I understand you correctly. >> >> It seems that the >>> CodeFile (.aspx.vb) is not considered a dependency; >> Where did you get this info from? >> >> -- >> -- >> Regards, >> Alvin Bruney [MVP ASP.NET] >> >> [Shameless Author plug] >> The O.W.C. Black Book, 2nd Edition >> Exclusively on www.lulu.com/owc $19.99 >> >> >> "Lee C." <nomail@spam.com> wrote in message >> news:ezCfmslhIHA.4320@TK2MSFTNGP06.phx.gbl... >>> Hello. I just discovered this method and tried it out. It seems that >>> the CodeFile (.aspx.vb) is not considered a dependency; yet, if I chose >>> to have that same code in the .aspx page, altering it would change the >>> Last-Modified value. >>> >>> Is this considered a bug? >>> >>> Cordially, >>> Lee C. >>> >
Alvin, I appreciate your replies; but, I think we are not yet understanding one another. You wrote, "...to rephrase, the dependency on the aspx file works but the dependency on the codebehind file does not work, right?" The first part of that statement sounds like a circular reference to me. I am talking about the Last-Modified date of the .aspx page; so, are you saying that the Last-Modified of the .aspx file is dependent on the .aspx file? :] If so, I would not state it that way, but we seem to agree. Regarding the second part of your statement, yes, I am saying that the HTTP header's Last-Modified Date sent to the requesting host by way of the HttpCachePolicy.SetLastModifiedFromFileDependencies method does not take into account the file system's "Date Modified" of the code beside file. You seem to be saying that this makes sense to you, because "The code beside files is of absolutely no use to the run-time" ...and it has to do with how the engine makes temp files...etc. I disagree, wholeheartedly, about this making sense, and so do Visual Studio and IIS. I'll try to illustrate below. In Visual Studio (I'm using 2008), add a new Web Form item, and check the "Place code in separate file" box. You'll get a .aspx page with page declaration including CodeFile="Default.aspx.vb" Inherits="_Default". Go ahead and delete the ..aspx.vb file since you feel that there is no dependency on it, then try to build that page in VS 2008. You'll get a build errors, for the Default.aspx file, to the effect of: 1. Error 1 The file '/Default.aspx.vb' does not exist. 2. Error 2 'Context' is not a member of '_Default'. That seems like a sign of dependency to me. Without fixing those, request the .aspx page via a browser, and IIS will tell you: Parser Error Message: The file '/Default.aspx.vb' does not exist. Source File: /ec/Default.aspx Again, that seems like another sign of dependency to me. I understand your technical explanation of how the ASP.NET engine uses my developer design-time files to make temp files to serve to hosts. That does not change the fact that it is doing something wrong with respect to the HttpCachePolicy.SetLastModifiedFromFileDependencies method. It is not taking into account the file system's "Date Modified" for the .aspx.vb--but, it should. (Your explanation regarding compiled temp files may make sense to you, but consider it for a first time building/compiling/running of a Web site versus after I make changes later.) Let's look at this from a slightly different angle. My real-world goal: I am trying to get the HTTP header's Last-Modified Date, of my .aspx page, which hosts request by name, to cache (publicly and/or privately) in a way that makes sense, so that the host's agent can smartly determine if it may reuse a cached version of my .aspx page--if it has not changed. Whether or not my .aspx page has changed certainly could--and should--depend upon whether the code beside file has changed! Why would I put code in the code beside if it does not change the .aspx page? For example, TextBox1.Text = "We are no longer accepting reservations for today." As I understand it, the code beside is simply an alternative place to store syntax that could have been in the .aspx page. (for the sake of separation) That's why Microsoft gave me the option to check the "Place code in separate file" box. If I check the box, the code beside consequently must/should be considered when determining what Last-Modified Date to send to the requesting host--but it isn't. If I do *not* check the "Place code in separate file" box when I add a new Web Form item, forcing me to put my "code beside" code into my .aspx page inside <% %> delimiters, the HTTP header's Last-Modified Date, via the HttpCachePolicy.SetLastModifiedFromFileDependencies method, will always reflect the file save date of changes to CLR code inside the <% %> delimiters. If I do use code behind and make the same code change, the HttpCachePolicy.SetLastModifiedFromFileDependencies method will not take into account the saving of those same CLR code changes, giving an outdated HTTP header Last-Modified Date. That should not be! , Lee C. [quoted text, click to view] "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message news:15FE6AAB-206E-4E62-9036-829C2D5E488B@microsoft.com... > Ok, I understand what you are saying - to rephrase, the dependency on the > aspx file works but the dependency on the codebehind file does not work, > right? The code beside files is of absolutely no use to the run-time, why > should there be a dependency on it? The contents of the file is compiled > into binary and placed in a temp location. Access to the types which were > defined in the file is occuring thru that temp binary at run-time - the > code file plays no part point forward. > > -- > -- > Regards, > Alvin Bruney [MVP ASP.NET] > > [Shameless Author plug] > The O.W.C. Black Book, 2nd Edition > Exclusively on www.lulu.com/owc $19.99 > > > "Lee C." <nomail@spam.com> wrote in message > news:O3zd19whIHA.5208@TK2MSFTNGP04.phx.gbl... >> Thanks for the reply, Alvin. I got that info from watching the HTTP >> requests, in detail, with Fiddler2 ( http://www.fiddlertool.com/fiddler/). >> >> IMO, the design is flawed. The CodeFile can alter the presentation; >> thus, it should be considered when determining the Last-Modified. >> >> If I put the presentation altering code in the .aspx page inside script >> delimiters, when I save the file, it would affect the Last-Modified. If >> I take that same code and put it in the CodeFile and save it, the save >> does not affect the Last-Modified. That is illogical. >> >> Cordially, >> Lee C. >> >> >> "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message >> news:51EE9819-C16F-448C-A714-E67D57F1855C@microsoft.com... >>> Nope, that's by design if I understand you correctly. >>> >>> It seems that the >>>> CodeFile (.aspx.vb) is not considered a dependency; >>> Where did you get this info from? >>> >>> -- >>> -- >>> Regards, >>> Alvin Bruney [MVP ASP.NET] >>> >>> [Shameless Author plug] >>> The O.W.C. Black Book, 2nd Edition >>> Exclusively on www.lulu.com/owc $19.99 >>> >>> >>> "Lee C." <nomail@spam.com> wrote in message >>> news:ezCfmslhIHA.4320@TK2MSFTNGP06.phx.gbl... >>>> Hello. I just discovered this method and tried it out. It seems that >>>> the CodeFile (.aspx.vb) is not considered a dependency; yet, if I chose >>>> to have that same code in the .aspx page, altering it would change the >>>> Last-Modified value. >>>> >>>> Is this considered a bug? >>>> >>>> Cordially, >>>> Lee C. >>>> >> >>
Have a look at this kb article, its a long shot but there is a bug in the method. See the fix works for you. http://support.microsoft.com/kb/909643 -- -- Regards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The O.W.C. Black Book, 2nd Edition Exclusively on www.lulu.com/owc $19.99 [quoted text, click to view] "Lee C." <nomail@spam.com> wrote in message news:#73TsajiIHA.4868@TK2MSFTNGP03.phx.gbl... > Alvin, > > I appreciate your replies; but, I think we are not yet understanding one > another. > > You wrote, "...to rephrase, the dependency on the aspx file works but the > dependency on the codebehind file does not work, right?" > > The first part of that statement sounds like a circular reference to me. > I am talking about the Last-Modified date of the .aspx page; so, are you > saying that the Last-Modified of the .aspx file is dependent on the .aspx > file? :] If so, I would not state it that way, but we seem to agree. > > Regarding the second part of your statement, yes, I am saying that the > HTTP header's Last-Modified Date sent to the requesting host by way of the > HttpCachePolicy.SetLastModifiedFromFileDependencies method does not take > into account the file system's "Date Modified" of the code beside file. > > You seem to be saying that this makes sense to you, because "The code > beside files is of absolutely no use to the run-time" ...and it has to do > with how the engine makes temp files...etc. I disagree, wholeheartedly, > about this making sense, and so do Visual Studio and IIS. I'll try to > illustrate below. > > In Visual Studio (I'm using 2008), add a new Web Form item, and check the > "Place code in separate file" box. You'll get a .aspx page with page > declaration including CodeFile="Default.aspx.vb" Inherits="_Default". Go > ahead and delete the ..aspx.vb file since you feel that there is no > dependency on it, then try to build that page in VS 2008. You'll get a > build errors, for the Default.aspx file, to the effect of: > 1. Error 1 The file '/Default.aspx.vb' does not exist. > 2. Error 2 'Context' is not a member of '_Default'. > That seems like a sign of dependency to me. > > Without fixing those, request the .aspx page via a browser, and IIS will > tell you: > Parser Error Message: The file '/Default.aspx.vb' does not exist. > Source File: /ec/Default.aspx > > Again, that seems like another sign of dependency to me. > > I understand your technical explanation of how the ASP.NET engine uses my > developer design-time files to make temp files to serve to hosts. That > does not change the fact that it is doing something wrong with respect to > the HttpCachePolicy.SetLastModifiedFromFileDependencies method. It is not > taking into account the file system's "Date Modified" for the > .aspx.vb--but, it should. (Your explanation regarding compiled temp files > may make sense to you, but consider it for a first time > building/compiling/running of a Web site versus after I make changes > later.) > > Let's look at this from a slightly different angle. My real-world goal: I > am trying to get the HTTP header's Last-Modified Date, of my .aspx page, > which hosts request by name, to cache (publicly and/or privately) in a way > that makes sense, so that the host's agent can smartly determine if it may > reuse a cached version of my .aspx page--if it has not changed. Whether > or not my .aspx page has changed certainly could--and should--depend upon > whether the code beside file has changed! Why would I put code in the > code beside if it does not change the .aspx page? For example, > TextBox1.Text = "We are no longer accepting reservations for today." > > > As I understand it, the code beside is simply an alternative place to > store syntax that could have been in the .aspx page. (for the sake of > separation) That's why Microsoft gave me the option to check the "Place > code in separate file" box. If I check the box, the code beside > consequently must/should be considered when determining what Last-Modified > Date to send to the requesting host--but it isn't. > > If I do *not* check the "Place code in separate file" box when I add a new > Web Form item, forcing me to put my "code beside" code into my .aspx page > inside <% %> delimiters, the HTTP header's Last-Modified Date, via the > HttpCachePolicy.SetLastModifiedFromFileDependencies method, will always > reflect the file save date of changes to CLR code inside the <% %> > delimiters. > > If I do use code behind and make the same code change, the > HttpCachePolicy.SetLastModifiedFromFileDependencies method will not take > into account the saving of those same CLR code changes, giving an outdated > HTTP header Last-Modified Date. That should not be! > > , Lee C. > > > "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message > news:15FE6AAB-206E-4E62-9036-829C2D5E488B@microsoft.com... >> Ok, I understand what you are saying - to rephrase, the dependency on the >> aspx file works but the dependency on the codebehind file does not work, >> right? The code beside files is of absolutely no use to the run-time, why >> should there be a dependency on it? The contents of the file is compiled >> into binary and placed in a temp location. Access to the types which were >> defined in the file is occuring thru that temp binary at run-time - the >> code file plays no part point forward. >> >> -- >> -- >> Regards, >> Alvin Bruney [MVP ASP.NET] >> >> [Shameless Author plug] >> The O.W.C. Black Book, 2nd Edition >> Exclusively on www.lulu.com/owc $19.99 >> >> >> "Lee C." <nomail@spam.com> wrote in message >> news:O3zd19whIHA.5208@TK2MSFTNGP04.phx.gbl... >>> Thanks for the reply, Alvin. I got that info from watching the HTTP >>> requests, in detail, with Fiddler2 >>> ( http://www.fiddlertool.com/fiddler/). >>> >>> IMO, the design is flawed. The CodeFile can alter the presentation; >>> thus, it should be considered when determining the Last-Modified. >>> >>> If I put the presentation altering code in the .aspx page inside script >>> delimiters, when I save the file, it would affect the Last-Modified. If >>> I take that same code and put it in the CodeFile and save it, the save >>> does not affect the Last-Modified. That is illogical. >>> >>> Cordially, >>> Lee C. >>> >>> >>> "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message >>> news:51EE9819-C16F-448C-A714-E67D57F1855C@microsoft.com... >>>> Nope, that's by design if I understand you correctly. >>>> >>>> It seems that the >>>>> CodeFile (.aspx.vb) is not considered a dependency; >>>> Where did you get this info from? >>>> >>>> -- >>>> -- >>>> Regards, >>>> Alvin Bruney [MVP ASP.NET] >>>> >>>> [Shameless Author plug] >>>> The O.W.C. Black Book, 2nd Edition >>>> Exclusively on www.lulu.com/owc $19.99 >>>> >>>>
Thanks, Alvin. That KB article made me think for a minute. I think that I was focused on looking for the "correct" HTTP Last-Modified date, via Fiddler, in my testing; i.e., I was separating the HTTP Last-Modified date from whether it actually served a cached page or not. I've done so much experimentation that I cannot recall for sure. I'm going to do some incremental troubleshooting/experimentation today or tomorrow. I will post my testing and findings. Cordially, Lee C. [quoted text, click to view] "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message news:7087A88C-7AE6-4539-999A-970F05A91DFE@microsoft.com... > Have a look at this kb article, its a long shot but there is a bug in the > method. See the fix works for you. > http://support.microsoft.com/kb/909643 > > > -- > -- > Regards, > Alvin Bruney [MVP ASP.NET] > > [Shameless Author plug] > The O.W.C. Black Book, 2nd Edition > Exclusively on www.lulu.com/owc $19.99 > > > "Lee C." <nomail@spam.com> wrote in message > news:#73TsajiIHA.4868@TK2MSFTNGP03.phx.gbl... >> Alvin, >> >> I appreciate your replies; but, I think we are not yet understanding one >> another. >> >> You wrote, "...to rephrase, the dependency on the aspx file works but the >> dependency on the codebehind file does not work, right?" >> >> The first part of that statement sounds like a circular reference to me. >> I am talking about the Last-Modified date of the .aspx page; so, are you >> saying that the Last-Modified of the .aspx file is dependent on the .aspx >> file? :] If so, I would not state it that way, but we seem to agree. >> >> Regarding the second part of your statement, yes, I am saying that the >> HTTP header's Last-Modified Date sent to the requesting host by way of >> the HttpCachePolicy.SetLastModifiedFromFileDependencies method does not >> take into account the file system's "Date Modified" of the code beside >> file. >> >> You seem to be saying that this makes sense to you, because "The code >> beside files is of absolutely no use to the run-time" ...and it has to do >> with how the engine makes temp files...etc. I disagree, wholeheartedly, >> about this making sense, and so do Visual Studio and IIS. I'll try to >> illustrate below. >> >> In Visual Studio (I'm using 2008), add a new Web Form item, and check the >> "Place code in separate file" box. You'll get a .aspx page with page >> declaration including CodeFile="Default.aspx.vb" Inherits="_Default". Go >> ahead and delete the ..aspx.vb file since you feel that there is no >> dependency on it, then try to build that page in VS 2008. You'll get a >> build errors, for the Default.aspx file, to the effect of: >> 1. Error 1 The file '/Default.aspx.vb' does not exist. >> 2. Error 2 'Context' is not a member of '_Default'. >> That seems like a sign of dependency to me. >> >> Without fixing those, request the .aspx page via a browser, and IIS will >> tell you: >> Parser Error Message: The file '/Default.aspx.vb' does not exist. >> Source File: /ec/Default.aspx >> >> Again, that seems like another sign of dependency to me. >> >> I understand your technical explanation of how the ASP.NET engine uses my >> developer design-time files to make temp files to serve to hosts. That >> does not change the fact that it is doing something wrong with respect to >> the HttpCachePolicy.SetLastModifiedFromFileDependencies method. It is >> not taking into account the file system's "Date Modified" for the >> .aspx.vb--but, it should. (Your explanation regarding compiled temp >> files may make sense to you, but consider it for a first time >> building/compiling/running of a Web site versus after I make changes >> later.) >> >> Let's look at this from a slightly different angle. My real-world goal: >> I am trying to get the HTTP header's Last-Modified Date, of my .aspx >> page, which hosts request by name, to cache (publicly and/or privately) >> in a way that makes sense, so that the host's agent can smartly determine >> if it may reuse a cached version of my .aspx page--if it has not changed. >> Whether or not my .aspx page has changed certainly could--and >> should--depend upon whether the code beside file has changed! Why would >> I put code in the code beside if it does not change the .aspx page? For >> example, >> TextBox1.Text = "We are no longer accepting reservations for today." >> >> >> As I understand it, the code beside is simply an alternative place to >> store syntax that could have been in the .aspx page. (for the sake of >> separation) That's why Microsoft gave me the option to check the "Place >> code in separate file" box. If I check the box, the code beside >> consequently must/should be considered when determining what >> Last-Modified Date to send to the requesting host--but it isn't. >> >> If I do *not* check the "Place code in separate file" box when I add a >> new Web Form item, forcing me to put my "code beside" code into my .aspx >> page inside <% %> delimiters, the HTTP header's Last-Modified Date, via >> the HttpCachePolicy.SetLastModifiedFromFileDependencies method, will >> always reflect the file save date of changes to CLR code inside the <% %> >> delimiters. >> >> If I do use code behind and make the same code change, the >> HttpCachePolicy.SetLastModifiedFromFileDependencies method will not take >> into account the saving of those same CLR code changes, giving an >> outdated HTTP header Last-Modified Date. That should not be! >> >> , Lee C. >> >> >> "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message >> news:15FE6AAB-206E-4E62-9036-829C2D5E488B@microsoft.com... >>> Ok, I understand what you are saying - to rephrase, the dependency on >>> the aspx file works but the dependency on the codebehind file does not >>> work, right? The code beside files is of absolutely no use to the >>> run-time, why should there be a dependency on it? The contents of the >>> file is compiled into binary and placed in a temp location. Access to >>> the types which were defined in the file is occuring thru that temp >>> binary at run-time - the code file plays no part point forward. >>> >>> -- >>> -- >>> Regards, >>> Alvin Bruney [MVP ASP.NET] >>> >>> [Shameless Author plug] >>> The O.W.C. Black Book, 2nd Edition >>> Exclusively on www.lulu.com/owc $19.99 >>> >>> >>> "Lee C." <nomail@spam.com> wrote in message >>> news:O3zd19whIHA.5208@TK2MSFTNGP04.phx.gbl... >>>> Thanks for the reply, Alvin. I got that info from watching the HTTP >>>> requests, in detail, with Fiddler2 >>>> ( http://www.fiddlertool.com/fiddler/). >>>> >>>> IMO, the design is flawed. The CodeFile can alter the presentation; >>>> thus, it should be considered when determining the Last-Modified. >>>> >>>> If I put the presentation altering code in the .aspx page inside script
Okay, it seems that my original post was unnecessary! I was originally testing/implementing on a (production) hosting server, directly, which was adversely affected by FTP client "touch" behavior not being supported by my hosting company. I started over just now, using my localhost IIS server, and the HttpCachePolicy.SetLastModifiedFromFileDependencies method works just as I desired. It's even better, because I can easily use Context.Response.AddFileDependency to create a dependency on any file I choose. I tried it with my CSS file, and it works great. This is the type of richness that I've come to expect from Microsoft, and they've delivered once again. Cordially, Lee [quoted text, click to view] "Lee C." <nomail@spam.com> wrote in message news:OyBYKVDjIHA.5260@TK2MSFTNGP03.phx.gbl... > Thanks, Alvin. That KB article made me think for a minute. I think that > I was focused on looking for the "correct" HTTP Last-Modified date, via > Fiddler, in my testing; i.e., I was separating the HTTP Last-Modified date > from whether it actually served a cached page or not. > > I've done so much experimentation that I cannot recall for sure. I'm > going to do some incremental troubleshooting/experimentation today or > tomorrow. I will post my testing and findings. > > Cordially, > Lee C. > > "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message > news:7087A88C-7AE6-4539-999A-970F05A91DFE@microsoft.com... >> Have a look at this kb article, its a long shot but there is a bug in the >> method. See the fix works for you. >> http://support.microsoft.com/kb/909643 >> >> >> -- >> -- >> Regards, >> Alvin Bruney [MVP ASP.NET] >> >> [Shameless Author plug] >> The O.W.C. Black Book, 2nd Edition >> Exclusively on www.lulu.com/owc $19.99 >> >> >> "Lee C." <nomail@spam.com> wrote in message >> news:#73TsajiIHA.4868@TK2MSFTNGP03.phx.gbl... >>> Alvin, >>> >>> I appreciate your replies; but, I think we are not yet understanding one >>> another. >>> >>> You wrote, "...to rephrase, the dependency on the aspx file works but >>> the dependency on the codebehind file does not work, right?" >>> >>> The first part of that statement sounds like a circular reference to me. >>> I am talking about the Last-Modified date of the .aspx page; so, are you >>> saying that the Last-Modified of the .aspx file is dependent on the >>> .aspx file? :] If so, I would not state it that way, but we seem to >>> agree. >>> >>> Regarding the second part of your statement, yes, I am saying that the >>> HTTP header's Last-Modified Date sent to the requesting host by way of >>> the HttpCachePolicy.SetLastModifiedFromFileDependencies method does not >>> take into account the file system's "Date Modified" of the code beside >>> file. >>> >>> You seem to be saying that this makes sense to you, because "The code >>> beside files is of absolutely no use to the run-time" ...and it has to >>> do with how the engine makes temp files...etc. I disagree, >>> wholeheartedly, about this making sense, and so do Visual Studio and >>> IIS. I'll try to illustrate below. >>> >>> In Visual Studio (I'm using 2008), add a new Web Form item, and check >>> the "Place code in separate file" box. You'll get a .aspx page with >>> page declaration including CodeFile="Default.aspx.vb" >>> Inherits="_Default". Go ahead and delete the ..aspx.vb file since you >>> feel that there is no dependency on it, then try to build that page in >>> VS 2008. You'll get a build errors, for the Default.aspx file, to the >>> effect of: >>> 1. Error 1 The file '/Default.aspx.vb' does not exist. >>> 2. Error 2 'Context' is not a member of '_Default'. >>> That seems like a sign of dependency to me. >>> >>> Without fixing those, request the .aspx page via a browser, and IIS will >>> tell you: >>> Parser Error Message: The file '/Default.aspx.vb' does not exist. >>> Source File: /ec/Default.aspx >>> >>> Again, that seems like another sign of dependency to me. >>> >>> I understand your technical explanation of how the ASP.NET engine uses >>> my developer design-time files to make temp files to serve to hosts. >>> That does not change the fact that it is doing something wrong with >>> respect to the HttpCachePolicy.SetLastModifiedFromFileDependencies >>> method. It is not taking into account the file system's "Date Modified" >>> for the .aspx.vb--but, it should. (Your explanation regarding compiled >>> temp files may make sense to you, but consider it for a first time >>> building/compiling/running of a Web site versus after I make changes >>> later.) >>> >>> Let's look at this from a slightly different angle. My real-world goal: >>> I am trying to get the HTTP header's Last-Modified Date, of my .aspx >>> page, which hosts request by name, to cache (publicly and/or privately) >>> in a way that makes sense, so that the host's agent can smartly >>> determine if it may reuse a cached version of my .aspx page--if it has >>> not changed. Whether or not my .aspx page has changed certainly >>> could--and should--depend upon whether the code beside file has changed! >>> Why would I put code in the code beside if it does not change the .aspx >>> page? For example, >>> TextBox1.Text = "We are no longer accepting reservations for today." >>> >>> >>> As I understand it, the code beside is simply an alternative place to >>> store syntax that could have been in the .aspx page. (for the sake of >>> separation) That's why Microsoft gave me the option to check the "Place >>> code in separate file" box. If I check the box, the code beside >>> consequently must/should be considered when determining what >>> Last-Modified Date to send to the requesting host--but it isn't. >>> >>> If I do *not* check the "Place code in separate file" box when I add a >>> new Web Form item, forcing me to put my "code beside" code into my .aspx >>> page inside <% %> delimiters, the HTTP header's Last-Modified Date, via >>> the HttpCachePolicy.SetLastModifiedFromFileDependencies method, will >>> always reflect the file save date of changes to CLR code inside the <% >>> %> delimiters. >>> >>> If I do use code behind and make the same code change, the >>> HttpCachePolicy.SetLastModifiedFromFileDependencies method will not take >>> into account the saving of those same CLR code changes, giving an >>> outdated HTTP header Last-Modified Date. That should not be! >>> >>> , Lee C. >>> >>> >>> "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message >>> news:15FE6AAB-206E-4E62-9036-829C2D5E488B@microsoft.com... >>>> Ok, I understand what you are saying - to rephrase, the dependency on >>>> the aspx file works but the dependency on the codebehind file does not >>>> work, right? The code beside files is of absolutely no use to the
shweet! -- Regards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The O.W.C. Black Book, 2nd Edition Exclusively on www.lulu.com/owc $19.99 ------------------------------------------------------- [quoted text, click to view] "Lee C." <nomail@spam.com> wrote in message news:OEx9$QIjIHA.6032@TK2MSFTNGP03.phx.gbl... > Okay, it seems that my original post was unnecessary! I was originally > testing/implementing on a (production) hosting server, directly, which was > adversely affected by FTP client "touch" behavior not being supported by > my hosting company. > > I started over just now, using my localhost IIS server, and the > HttpCachePolicy.SetLastModifiedFromFileDependencies method works just as I > desired. It's even better, because I can easily use > Context.Response.AddFileDependency to create a dependency on any file I > choose. I tried it with my CSS file, and it works great. This is the > type of richness that I've come to expect from Microsoft, and they've > delivered once again. > > Cordially, > Lee > > "Lee C." <nomail@spam.com> wrote in message > news:OyBYKVDjIHA.5260@TK2MSFTNGP03.phx.gbl... >> Thanks, Alvin. That KB article made me think for a minute. I think that >> I was focused on looking for the "correct" HTTP Last-Modified date, via >> Fiddler, in my testing; i.e., I was separating the HTTP Last-Modified >> date from whether it actually served a cached page or not. >> >> I've done so much experimentation that I cannot recall for sure. I'm >> going to do some incremental troubleshooting/experimentation today or >> tomorrow. I will post my testing and findings. >> >> Cordially, >> Lee C. >> >> "Alvin Bruney [ASP.NET MVP]" < www.lulu.com/owc> wrote in message >> news:7087A88C-7AE6-4539-999A-970F05A91DFE@microsoft.com... >>> Have a look at this kb article, its a long shot but there is a bug in >>> the method. See the fix works for you. >>> http://support.microsoft.com/kb/909643 >>> >>> >>> -- >>> -- >>> Regards, >>> Alvin Bruney [MVP ASP.NET] >>> >>> [Shameless Author plug] >>> The O.W.C. Black Book, 2nd Edition >>> Exclusively on www.lulu.com/owc $19.99 >>> >>> >>> "Lee C." <nomail@spam.com> wrote in message >>> news:#73TsajiIHA.4868@TK2MSFTNGP03.phx.gbl... >>>> Alvin, >>>> >>>> I appreciate your replies; but, I think we are not yet understanding >>>> one another. >>>> >>>> You wrote, "...to rephrase, the dependency on the aspx file works but >>>> the dependency on the codebehind file does not work, right?" >>>> >>>> The first part of that statement sounds like a circular reference to >>>> me. I am talking about the Last-Modified date of the .aspx page; so, >>>> are you saying that the Last-Modified of the .aspx file is dependent on >>>> the .aspx file? :] If so, I would not state it that way, but we seem >>>> to agree. >>>> >>>> Regarding the second part of your statement, yes, I am saying that the >>>> HTTP header's Last-Modified Date sent to the requesting host by way of >>>> the HttpCachePolicy.SetLastModifiedFromFileDependencies method does not >>>> take into account the file system's "Date Modified" of the code beside >>>> file. >>>> >>>> You seem to be saying that this makes sense to you, because "The code >>>> beside files is of absolutely no use to the run-time" ...and it has to >>>> do with how the engine makes temp files...etc. I disagree, >>>> wholeheartedly, about this making sense, and so do Visual Studio and >>>> IIS. I'll try to illustrate below. >>>> >>>> In Visual Studio (I'm using 2008), add a new Web Form item, and check >>>> the "Place code in separate file" box. You'll get a .aspx page with >>>> page declaration including CodeFile="Default.aspx.vb" >>>> Inherits="_Default". Go ahead and delete the ..aspx.vb file since you >>>> feel that there is no dependency on it, then try to build that page in >>>> VS 2008. You'll get a build errors, for the Default.aspx file, to the >>>> effect of: >>>> 1. Error 1 The file '/Default.aspx.vb' does not exist. >>>> 2. Error 2 'Context' is not a member of '_Default'. >>>> That seems like a sign of dependency to me. >>>> >>>> Without fixing those, request the .aspx page via a browser, and IIS >>>> will tell you: >>>> Parser Error Message: The file '/Default.aspx.vb' does not exist. >>>> Source File: /ec/Default.aspx >>>> >>>> Again, that seems like another sign of dependency to me. >>>> >>>> I understand your technical explanation of how the ASP.NET engine uses >>>> my developer design-time files to make temp files to serve to hosts. >>>> That does not change the fact that it is doing something wrong with >>>> respect to the HttpCachePolicy.SetLastModifiedFromFileDependencies >>>> method. It is not taking into account the file system's "Date >>>> Modified" for the .aspx.vb--but, it should. (Your explanation >>>> regarding compiled temp files may make sense to you, but consider it >>>> for a first time building/compiling/running of a Web site versus after >>>> I make changes later.) >>>> >>>> Let's look at this from a slightly different angle. My real-world >>>> goal: I am trying to get the HTTP header's Last-Modified Date, of my >>>> .aspx page, which hosts request by name, to cache (publicly and/or >>>> privately) in a way that makes sense, so that the host's agent can >>>> smartly determine if it may reuse a cached version of my .aspx page--if >>>> it has not changed. Whether or not my .aspx page has changed certainly >>>> could--and should--depend upon whether the code beside file has >>>> changed! Why would I put code in the code beside if it does not change >>>> the .aspx page? For example, >>>> TextBox1.Text = "We are no longer accepting reservations for today." >>>> >>>> >>>> As I understand it, the code beside is simply an alternative place to >>>> store syntax that could have been in the .aspx page. (for the sake of >>>> separation) That's why Microsoft gave me the option to check the "Place >>>> code in separate file" box. If I check the box, the code beside >>>> consequently must/should be considered when determining what >>>> Last-Modified Date to send to the requesting host--but it isn't. >>>> >>>> If I do *not* check the "Place code in separate file" box when I add a >>>> new Web Form item, forcing me to put my "code beside" code into my >>>> .aspx page inside <% %> delimiters, the HTTP header's Last-Modified >>>> Date, via the HttpCachePolicy.SetLastModifiedFromFileDependencies >>>> method, will always reflect the file save date of changes to CLR code >>>> inside the <% %> delimiters. >>>> >>>> If I do use code behind and make the same code change, the >>>> HttpCachePolicy.SetLastModifiedFromFileDependencies method will not >>>> take into account the saving of those same CLR code changes, giving an >>>> outdated HTTP header Last-Modified Date. That should not be!
Don't see what you're looking for? Try a search.
|