473,378 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

setting If-Modified-Since programmatically

I would like to set the If-Modified-Since to the last modified time of
the file, how does one go about doing that?

Jul 4 '06 #1
4 1706
If it's an ASP.NET page, you might be able to play with Response.AddHeader -
though I'm not sure if IIS will overwrite the value. If IIS does overwrite
the value OR you want to control the last-modified for an non-aspx.net file,
you're likely stuck with having to write an ISAPI filter. With IIS 7, you'll
be able to write those in .NET (yay).

Karl

--
http://www.openmymind.net/

"Sam Carleton" <sc*******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I would like to set the If-Modified-Since to the last modified time of
the file, how does one go about doing that?

Jul 4 '06 #2

Karl Seguin [MVP] wrote:
If it's an ASP.NET page, you might be able to play with Response.AddHeader -
though I'm not sure if IIS will overwrite the value. If IIS does overwrite
the value OR you want to control the last-modified for an non-aspx.net file,
you're likely stuck with having to write an ISAPI filter. With IIS 7, you'll
be able to write those in .NET (yay).
Karl,

Thank you! I have been a windows developer for many moons now. I have
tabled in web programming, but.. Well, it is a very different world;)
Question: now do I confirm the code is working? Here is what I have
and I am not seeing anything different in the generated HTML:

FileInfo fi = new FileInfo(this.Request.PhysicalPath);
this.Response.AddHeader("If-Modified-Since",
fi.LastWriteTimeUtc.ToString("r"));

Sam

Jul 4 '06 #3
headers aren't rendered in the html.

Get a tool like fiddler (www.fiddlertool.com, free) set it up to proxy your
browser (IE should automatically detect it running) and hit the page. Then
look at the response headers before and after, hopefully something changed.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Sam Carleton" <sc*******@gmail.comwrote in message
news:11**********************@a14g2000cwb.googlegr oups.com...
>
Karl Seguin [MVP] wrote:
>If it's an ASP.NET page, you might be able to play with
Response.AddHeader -
though I'm not sure if IIS will overwrite the value. If IIS does
overwrite
the value OR you want to control the last-modified for an non-aspx.net
file,
you're likely stuck with having to write an ISAPI filter. With IIS 7,
you'll
be able to write those in .NET (yay).

Karl,

Thank you! I have been a windows developer for many moons now. I have
tabled in web programming, but.. Well, it is a very different world;)
Question: now do I confirm the code is working? Here is what I have
and I am not seeing anything different in the generated HTML:

FileInfo fi = new FileInfo(this.Request.PhysicalPath);
this.Response.AddHeader("If-Modified-Since",
fi.LastWriteTimeUtc.ToString("r"));

Sam

Jul 4 '06 #4

Karl Seguin [MVP] wrote:
headers aren't rendered in the html.

Get a tool like fiddler (www.fiddlertool.com, free) set it up to proxy your
browser (IE should automatically detect it running) and hit the page. Then
look at the response headers before and after, hopefully something changed.
Karl,

Thanks a million! Fiddler shows that it is working!!!!! I much
appreciate it!

Sam

Jul 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Niyazi | last post by:
Hi, We have and IBM AS400 and I belive the reional setting is Turkish. The IBM Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish characters. Now my PC has English...
0
by: Rhino | last post by:
I am working with SQL Functions in DB2 for Windows/Linux/UNIX (V8.2.1) and am having a problem setting input parameters for SQL Functions to null in the Development Center. My simple function,...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
2
by: junlia | last post by:
Hi All, I am working on a project that acts as a bridge. It does some checking with post xml data, and then redirects the request to an appropriate page. However, we find that depends on the...
1
by: Dachshund Digital | last post by:
I know there must be a way to do this... in .NET 2.0? I have a situation where I know the name of the setting, and want to pass it into a function, and set or get the corresponding setting. ...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
7
by: Ronald S. Cook | last post by:
In a .NET Windows app, if I set somehting like the title of the form to "MyApp" at run-time, will that make the app run slightly slower than if I had set the title at design-time? Thanks, Ron
8
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
7
by: PetterL | last post by:
I have a setting called My.settings.firstrun set to True, set in the setting manager. When i read this in the first form form_Load in a IF sentence it always come out as false. I have tried to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.