Hi there, I have page I created.. and this is one part of its code... <!--#include file="sms1.txt"--> <!--#include file="sms2.txt"--> <!--#include file="sms3.txt"--> <!--#include file="sms4.txt"--> <!--#include file="sms5.txt"--> Code (markup): etc... So this are just plain txt files that I want to include on my page, right.. Now the thing is, not all of these txt files are always on server, and that is ok to be... So for example I can sometimes have situation where file sms4.txt is not found on server... I will not go in further explaining why, but it's the way it is and the way it should be... Now what I want is if sms4.txt is not on server, I want to show the included content of other txt files, and make full asp page viewable in the browser even without missed included txt file and want sms4.txt to be skipped... Rather than that, in reallity if there is not sms4.txt file I get error 0126 file on page view, which tells me that included file sms4.txt is not found on server... So how do I make page shown and other txt files included, and page to works even if any of other txt files are missed from server? Tnx!
You could use the FileSystemObject to check if each file exists before including it... But i believe that the includes are done before any script is executed. So you would also have to write an include function that simply reads the file and outputs it (fairly easily done)...
you can use fileexits method(fso) <% ' Asp -> Fso -> bay Ozgur set fso=server.createobject("scripting.filesystemobject") if fso.fileexists(server.mappath("file_address/file_name")) then %> <!--#include file="filename.txt"--> <% end if %> Code (markup):