|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Asp problem... I have no idea how to solve it....
Hi guys..
I'm building an entire portal system, and the work goes really well! It's built using ASP language and ACCESS database... While working, I faced a problem: When I add ASP code to a database field,and then try to "included" it to the web-page ,or call it, the browser does't show anything.... I checked the source file , and I found that it only got the code from the database, and KEPT IT AS IT WAS without actually compiling it... The code was "hidden" in the current ASP file.. What I meant actually is this: Our mechanism works in a away that, the ASP code of each page is found in a field in a table found in the database..... example: If the field contains : <%=response.write "my name"%> I want the result tol be : my name in a blank page This also will work for all other ASP scripts and sentences that will be retrieved from the database.. What actually happens is that the browser (Internet Explorer in this case) just "copies" the code and doesn't elaborate or compile it.... In the case of the previous example, the page is white, and if you look at the source, you'll find that the ASP sentence I added is found there, but the browser didn't use it at all... To be more clear, I tried to put HTML code in field, and then retrieve it, and everything went fine... For example, If I've written this sentence: "<b>my name</b>" in a field and then retrieved it from the datbae into the current page, the result will be a page with "My name" written in BOLD!!! The strange this is that when I add normal HTML code, everything goes well, and the browser outputs it greatly, but it's not the same with ASP code.. I just make a connection with the database in the top of the page, and then get or retrieve the fields I need from it... If the content of the field is normal text or HTML code, everything works fine, but it it is ASP code, it doesn't work... I'm using this methode intentionally in order to make my portal very customizable.... It would take too much time to explain it... Now, is there any way to solve this problem???? Is there any script to make this work???? Your help would be gr8ly appreciated!!! Thanx a lot in advance!!! KamaL |
|
#2
|
|||
|
|||
|
I think the problem comes from the way that the ASP code is handled compared to HTML.
The ASP code is executed by the server and not the browser. The server actually goes through your code executing it (ie. calling your database and writing the fields contents), but then it moves to the next ASP line and doesn't deal with what was just written. So the browser gets a page mixed with HTML, which it understands and displays correctly, and ASP, which it does not understand and simply ignores. You may try writing the code to another page and redirecting to that one so the server will then execute the new ASP code. That suggestion may not be practical for you though. |
|
#3
|
|||
|
|||
|
If you use NT, you need to install Option pack 4 in order for the code to be executed.
Also, you might wanna check your virtual directory properties (or your website properties) in your Management Console to ensure you can read and execute script in this website. To me it seems your system is not configured for asp. Thanks, -Rogier
__________________
- Rogier Doekes |
|
#4
|
|||
|
|||
|
Thanx guys for the reply!!
I must say that my website and virtual host (my harddisk) is installed well and everything works fine.... I built tons of ASP pages and they were all good, so this is not the point.. I heard the first suggestion from different people: directing the code to a new page, and then retrieving it.... But I simply don't know how to implement it exactly!!! Do u know any way to do it???? I hope you could help.. If there are any other suggestions, it would be gr8 to hear them!!!!! Thanx a lot again!!! KamaL |
|
#5
|
|||
|
|||
|
I do not think you can do this, since the server expects the code in the page. Yes you can dynamically create content from a database, but you cannot execute code out of the database.
This is because the asp code is server side and is compiled first, then page building top-down with the lines of code in there. What you ask is for the parser to 1. first compile the code 2. create the page, execute the code in the page 3. compile again 4. execute asp code from the database, which is already written to the browser Step 3 and 4 cannot be done. |
|
#6
|
|||
|
|||
|
Hi
If you are using ASP 3.0 then why don't use server.execute? |
|
#7
|
|||
|
|||
|
I do something similar and after reading the ASP code from the DB I write it to the screen with Response.Write
i.e. sql = "SELECT code FROM table" Set rs = db.Execute(sql) Response.Write rs("code") Hope that helps in your case. |
|
#8
|
|||
|
|||
|
Here's some really stupid questions, but when all else fails ...
Your asp pages are saved on a webserver, heh? and you're typing in http://webserveraddress/aspfilename.asp? Just checking. |
|
#9
|
|||
|
|||
|
You could not parse asp code dynamicaly
the only tink you could not is output in html your asp code with server.htmlencode(your db field) but it will not produce what you want instead of keeping <%=response.write "my name"%> in your db field only keep "my name" and do your response.write in your asp pages... |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Asp problem... I have no idea how to solve it.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|