|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
is there a way in asp that you can prepend a file to the beginning of page you access in a directory? i'm not talking about the include statement because you have to put it in on everypage manually. i know you can do this in cold fusion, but i don't know how to do it in asp or if its even possible
|
|
#2
|
|||
|
|||
|
Do you mean
something like using FSO(File System Object) to read the content of a file and then prepend it ?
If so, use FSO, read the file you want then...voila! no? Hope this helps! Sincerely Vlince |
|
#3
|
||||
|
||||
|
not quite
ok here is what i'm thinking. i have to have an asp file be a part of the beginning of every file in a certain directory. it would work similar to an #include file="somefile.asp" accept i wouldn't have to put that in everyfile, the server would just automatically insert it at the beginning of every asp file requested. any other suggestions?
|
|
#4
|
|||
|
|||
|
Well that's pretty much why include files are used but let's try something else.
You say: -->i have to have an asp file be a part of the beginning of every file in a certain directory<-- When you say a *certain directory* I assume that you must have a layout like this: wwwroot-->MySite Then MySite has 3 sub directories wwwroot-->MySite-->directory1 -->directory2 -->directory3 Let's say the files that are in a certain directory are inside the directory3 ok. Assuming *directory3* holds 5 .asp pages page1.asp page2asp page3.asp page4.asp page5.asp The structure would then look something like: wwwroot-->MySite-->directory1 -->directory2 -->directory3-->page1.asp -->page2.asp -->page3.asp -->page4.asp -->page5.asp Now you want, for every asp pages inside *directory3*, prepend the content of another file right? So why not have an asp file called *prepend.asp* inside *directory3* that you will include inside all 5 asp pages? -->the server would just automatically insert it at the beginning of every asp<-- The server's job is to interpret the code(logic) *you* the programmer did(well its actually the .dll's job but you get it) The server can't without some sort of indication(could be a Const, a QueryString parameter, cookie...) decide if he prepend something or not. Since the .asp pages inside *directory3* are unique why not use the *prepend.asp* approach? Unless I'm missing something... Oh and what's the *content* that you are trying to prepend ? Is it code? that must be interpreted? Is it simple text? What? I'm curious ![]() Hope this helps! Sincerely Vlince |
|
#5
|
||||
|
||||
|
thanks for the suggestion. i'm doing a script to determine if the user is logged in. i've contemplated using the #include file, but i've already coded alot of pages and was hoping that there was an easier way than opening up each page to insert one line of code. as i said earlier if i was lucky enough to be using cold fusion, there is a special name you can give a .cfm file that will process it before anthing else is in the directory its in. really nice for changeing security scripts. just hoping there was a special case like that for .asp files. anyone know?
|
|
#6
|
|||
|
|||
|
Well there is...they are called *include files*
Oh...wait perhaps...I just found something that *might* help you! Have a look here: http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=57 Hope this helps! Sincerely Vlince |
|
#7
|
||||
|
||||
|
ok i guess i should be asking this a bit different. i have a directory we'll call it dir1. in dir1 i have a bunch of .asp files. now for each of these files i need to have something added to the beginning, no matter what the file is. in cold fusion, there is a special file name (as in its name is a reserved word, perhaps like global.asa) where you just name a file we'll say its called pre.cfm. all i have to do is put that special file in the same folder, and for every request for a file from that folder that file is automattically added to the beginning, without having to go into each file and adding an include file statement. can you do that with asp? make sense? is there a way to do it?
|
|
#8
|
|||
|
|||
|
Ok this is more clear now
![]() The answer to this is: I don't know Honestly I've never heard/seen anything like that so I'd have to say NO you can do that in asp like you claim you can in Cold Fusion. There isn't a *magical* file that you put inside a *folder* that will affect all the folder's content. When I say *magical* I'm being sarcastic but you got that... What your asking is like the web.config file in .NET but the only thing that comes close to that in ASP is the global.asa file but then again I'ts NOT as versatile as the web.config file. *Perhaps* and that is a BIG perhaps Application/Session variables could help but then again you'd have to code something...dont want to get you/me more confused here! Hope this helps! Sincerely Vlince |
|
#9
|
||||
|
||||
|
Vlince is right, the way to include something at the beginning of your pages is with #include file. There isn't a way to automatically prepend like you asked about.
|
|
#10
|
||||
|
||||
|
thanks. its easier to move on once you know that something can't be done. happy coding.
word to your mother. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > prepending an asp file to every document in a directory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|