Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts

    variable includes

    i was wondering if there was any way to include like
    Code:
    <%=variable%>.asp
    or some other way of this, i am trying to do a
    Code:
    default.asp?page=news
    and it includes news.asp or something like that, the only way i have seen it working is with the webbridge object like

    Code:
    <%if Request.QueryString("page") = "" then
    page = "news"
    else
    page = Request.QueryString("page")
    end if%>
    <object type="text/x-scriptlet" width=100% height="250" data="<%=page%>.asp" VIEWASTEXT>
    </object>
    which only works on IE4+ and you cant select it properly as well as some other coding problems on pages that are designed to work only from the default page so that they cannot be used on their own

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    With IIS 5.0 or later you can use: Server.execute to call one ASP page from another.

    See: http://msdn.microsoft.com/library/de...er02282000.asp
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Oct 2003
    Location
    London, UK
    Posts
    411
    Thanks
    0
    Thanked 1 Time in 1 Post
    Marcus Tucker / www / blog
    Web Analyst Programmer / Voted SPF "ASP Guru"

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That second link leaves a bit to be desired, I'd recommend learning FileSystemObject thoroughly on your own (i.e. http://www.w3schools.com), and reading his article for ideas if you must.

    However the first link is even better reading, I always recommend 4guysfromrolla, it's a great ASP site. I have learned much from there.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #5
    Regular Coder
    Join Date
    Mar 2003
    Posts
    241
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FSO

    Whammy, In the days when I learned asp somebody recommended me to stay away from fso. When the fso access a file, it can only handle that request to one visitor at the time. This will mean it will be incredible slow when the server is busy and has many concurrent users.

    Do you have any info on this, I'm just curious if this is true or not.

  • #6
    Regular Coder
    Join Date
    Aug 2003
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FSO

    Originally posted by Caffeine
    Whammy, In the days when I learned asp somebody recommended me to stay away from fso. When the fso access a file, it can only handle that request to one visitor at the time. This will mean it will be incredible slow when the server is busy and has many concurrent users.

    Just remember I heard the same thing... one night very late after a party (is it the reason why I forgot it? ) it seems weird... Never had the opportunity to test it. It's kinda off-topic but well whammy, if you have infos about it I'm also interested...

  • #7
    Regular Coder
    Join Date
    Oct 2003
    Location
    London, UK
    Posts
    411
    Thanks
    0
    Thanked 1 Time in 1 Post
    Originally posted by Caffeine
    Whammy, In the days when I learned asp somebody recommended me to stay away from fso. When the fso access a file, it can only handle that request to one visitor at the time. This will mean it will be incredible slow when the server is busy and has many concurrent users.

    Do you have any info on this, I'm just curious if this is true or not.
    I don't know for a fact whether the FSO is *that* bad, but it certainly is pretty inefficient.

    For scalability, you should use the FSO for everything APART from the actual loading and saving of files. For *those* operations you should use the ADO.Stream object (see your ADO reference documentation).

    For example, here are some stream-based functions from my code library:
    Code:
    'Load a file from disk
    Function LoadStream(FilePath)
    	Dim objStream
    
    	If FileExists(FilePath) Then
    		Set objStream = Server.CreateObject("ADODB.Stream")
    	
    		objStream.Type = 1 'adTypeBinary=1
    		objStream.Open
    	
    		objStream.LoadFromFile FilePath
    		LoadStream = objStream.Read
    		
    		objStream.Close
    		Set objStream = Nothing
    	Else
    		Set LoadStream = Nothing
    	End If
    End Function
    
    
    'Save a file to disk
    Function SaveStream(FilePath,Data)
    	Dim objStream
    	Set objStream = Server.CreateObject("ADODB.Stream")
    
    	objStream.Type = 1 'adTypeBinary=1
    	objStream.Open
    
    	objStream.Write Data
    	objStream.SaveToFile FilePath, 2
    
    	objStream.Close
    	Set objStream = Nothing
    End Function
    Last edited by M@rco; 10-14-2003 at 12:57 PM.
    Marcus Tucker / www / blog
    Web Analyst Programmer / Voted SPF "ASP Guru"

  • #8
    Regular Coder
    Join Date
    Aug 2003
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanx M@rco, very very helpfull I'll try this as soon as possible

  • #9
    Regular Coder
    Join Date
    Oct 2003
    Location
    London, UK
    Posts
    411
    Thanks
    0
    Thanked 1 Time in 1 Post
    Y'welcome! Just noticed that I'd left in a call to my debugging function, so please remove it. (I've edited the code above)
    Marcus Tucker / www / blog
    Web Analyst Programmer / Voted SPF "ASP Guru"

  • #10
    Regular Coder
    Join Date
    Aug 2003
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok no problem.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I only use FSO for things that very few people will be accessing (like a client's account manager accessing a .csv file as a report, or a simple blog chat client), so I haven't run into any problems with it, at all.

    I _definitely_ would not use FSO in place of a database solution, if that's what you're wondering.

    They each have their own place - and it takes an understanding of relational databases to know this. You have to determine beforehand how many people could possibly access this information concurrently, and the MAIN thing to understand is what I'm _always_ trying to get across:

    What are you trying to accomplish?

    That's the first thing that MUST be understood before you begin programming any application.

    Last edited by whammy; 10-15-2003 at 03:59 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •