Hi John,
As you mentioned, the code is used in page codebehind. So that checking
page is in the same web application of other pages you want to check(or at
least on the same server machine)? If so, I agree that the System.IO
components are the proper approach here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "John" <(E-Mail Removed)>
>References: <#(E-Mail Removed)>
<uU#(E-Mail Removed)>
>Subject: Re: Check for file existence within own site
>Date: Tue, 29 Jan 2008 18:46:34 -0000
>
>Hello Kevin,
>
>Thanks for your reply. When I say file, I mean I'm checking the existance
>of another page (MyPage.aspx) within the site. Does that change things?
>
>Thanks
>
>John
>
>"Kevin Spencer" <unclechutney@localhost> wrote in message
>news:uU%(E-Mail Removed)...
>> If you're looking for a file that should be on the same machine, and
your
>> app has the proper file system permissions, that is a perfectly fine way
>> to check for its existence. Otherwise, you can create an HttpRequest,
and
>> see if you get a 404 (Not Found) Response code.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Chicken Salad Surgeon
>> Microsoft MVP
>>
>> "John" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Hi there,
>>>
>>> I have a method in a code behind class that, given a string, checks to
>>> see if the respective file exists within the same site. I'm using this:
>>>
>>> System.IO.File.Exists(strFilePath)
>>>
>>> ...but is that the right way to check for a file in your own site and
if
>>> so does strFilePath need to be in a particular format?
>>>
>>> Thanks in advance.
>>>
>>> John
>>>
>>>
>>
>>
>
>
>
|