ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 12th, 2003, 03:49 AM
SoaringTortoise SoaringTortoise is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 26 SoaringTortoise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Creating ASP code fragments 'on the fly'

Hi,

I'm trying to give my clients a bit of extra controll over their application by allowing them to modify parts of my ASP program using a code template. For example, on the landing page, the program displays a list of all current tasks in the user's ToDo list, but different clients may want to handle specific items in that list in different ways: e.g. Client 1 wants to highlight the oldest items in a different color. Client 2 may want to Alert. Client 3 wants to kick off a message through Email. Client 4 wants to force the user to attend to any messages older than 4 days.

Rather than create a completely custom page for each client, I want to keep the original page exactly as is, but allow each client to configure additional code that will be inserted into the page on load.

One way of doing this is to use Include pages, but I can't use this in this case because there may be several clients hosted on the same server, plus the clients would need FTP access to upload their own include files.

I could also handle most situations in JavaScript, such that the ASP file just writes out the Script block as its loading, but there are some things that are only possible in ASP.

I would prefer to handle this through a database entry which the client can make in their profile page, and then smack the code from the database into the ASP file as it's being requested.

Is this possible, and if so, how?

Reply With Quote
  #2  
Old September 12th, 2003, 07:56 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
---BEGIN QUOTE---
Is this possible, and if so, how?
---END QUOTE---

Well anything is possible, what you ask for is rather hard to explain, what I mean is that you can have/use many different approaches/techniques to achieve what you want.

It would take too long to explain all possible scenario's

One way of doing this is allowing the users to customize what they want. You then save these settings/customization into a database.
Once the user logs in again, you retrieve these settings/customization from your database and display(or do whatever) them in the way it's suppose to be(hope that makes sense!)

Now since we/I'm missing a lot of specs, I can't offer you more help. But you get the idea right!

The including can also be a nice approach!

hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old September 12th, 2003, 11:49 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,959 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 59 m 14 sec
Reputation Power: 802
VBS has a mechanism to build a code string and execute the string, maybe it will do what you want.

http://msdn.microsoft.com/library/d...sstmexecute.asp

Reply With Quote
  #4  
Old September 12th, 2003, 01:24 PM
SoaringTortoise SoaringTortoise is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 26 SoaringTortoise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Vlince: Yes, but other than trying to think of every possible thing that the all clients want and then switching that piece of code on/off according to a single client's settings is a near-impossible task.

Doug G: Yes, but again I think that the VBS method is entirely client-side.

Reply With Quote
  #5  
Old September 12th, 2003, 02:23 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 13 m 21 sec
Reputation Power: 76
So you want users to be able to enter asp code of their own devising, which is then executed on your server? I hope you have some sort of moderation/review before you allow the code to run, or you could be opening quite a security hole in your system.
As far as how to do it, I think Vlince's way is best. Unless your clients have specifically asked to be able to modify any arbitrary parts of your page, you don't need to give them that capability. Come up with a dozen useful modifications, or ask the clients for their top 5 requests, and just code those options.
Giving complete control is perhaps possible, but it would be prohibitively difficult, and allow possible security breaches. For that reason, using a certain set of customizable preferences is a good idea.

Reply With Quote
  #6  
Old September 12th, 2003, 03:25 PM
SoaringTortoise SoaringTortoise is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 26 SoaringTortoise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No, for sure it's a big security problem in most situations, but this is for use in an Intranet-only situation - the app I've written is likely to be used by multiple departments for different things in the same company.

They have their own internal IT department, and it is hankering to create their own custom bits and bobs, but neither they nor I want them to be messing with the main code. So, the idea is to create entry points in the ASP into which their custom code can be inserted.

I'm just trying to find a way to manage that insertion according to the user and department. I figure that the logical place to store the snippet is in a database keyed by user/department. Then when the page loads I can say, "At this point, insert the code from tblUserCodes for the current user." I can do this quite easilly using javascript (just by appending a javascript code block to the HTML stream), but as I said, there are some things (such as specific data requests) that can't be done that way.

I could do something like this

If DeparmentID = 1 then
#Include Dep1.inc
Elseif DeparmentID = 2 then
#Include Dep2.inc
etc..

But that forces me to use files, and it's clumsy for all kinds of reasons.

As I understand it, the include directive gets processed before any scripting, so although the above would work, it would bloat the ASP. Also, it would be cumbersome to deal with a dynamic organisation structure.

Last edited by SoaringTortoise : September 12th, 2003 at 03:27 PM.

Reply With Quote
  #7  
Old September 12th, 2003, 03:36 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 13 m 21 sec
Reputation Power: 76
The includes could be cumbersome, but the bloating/slowdown occurs mostly if the included file has many functions and variables that are not used by the script that does the including. If your include files only contain what you need, then performance is not harmed much.

If you can handle most of the customization using javascript, with just a few things that need to be done on the server side, I would say use the include files with logic (be sure to set that up right, http://www.microsoft.com/windows200...asp/iiwainc.htm shows how to do it) for the things that have to be asp, and for the rest use your javascript.

Reply With Quote
  #8  
Old September 13th, 2003, 01:25 AM
SoaringTortoise SoaringTortoise is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 26 SoaringTortoise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well put. I am convinced. Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Creating ASP code fragments 'on the fly'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT