views:

92

answers:

1

I'm using asp.net 3.0.

I have Page A doing a Server.Transfer to Page B.

On both page A and Page B I'm want to be able to use System.IO.File.GetLastWriteTime(MapPath(Page.Request.Path.ToString())) in order to display the last modified date at the top of each file.

This works well on page A, but when I use Server.Transfer to page B, Page.Request.Path still refers to Page A as opposed to Page B.

Is there any way around this without changing from Server.Transfer to Response.Redirect (Server.Transfer is important for my other sections of code on both pages)

+1  A: 

Try this instead:

System.IO.File.GetLastWriteTime(MapPath(Page.Request.AppRelativeCurrentExecutionFilePath))
Darin Dimitrov
Absolutely brilliant. Thanks a million, I was scratching my head on this for quite a while.