fp2002 corrupts asp code (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


jonance -> fp2002 corrupts asp code (12/10/2002 14:48:03)

Hi,

I was trying to paste the following code into a fp2002 document in HTML view:

<%
For Each File in Upload.Files
Response.Write File.extractfilename
Next
%>

Everytime i save the document...it moves it all onto one line adn the code doesn' t work...i get " expected" end of statement. Is there a way to make FP stop doing this and preserve the line breaks? I saw one option that says " allow link breaks in tags" , checked it but it kept doing the same thing. Help???

Thanks,
John




bobby -> RE: fp2002 corrupts asp code (12/10/2002 14:54:32)

Try Tools > Page Options > HTML Source

Click the box for " Preserve existing html" and see if that helps...

I write ASP in html view all the time without any problems... you might try typing it in the page instead of pasting...

If all else fails, save it as a text file and " include" it in your .asp page.

[:)]




DarlingBri -> RE: fp2002 corrupts asp code (12/10/2002 14:59:41)

You do need " Preserve Existing HTML" on, but one thing that helps preserve the formatting of code you' re trying to insert like that is pasting it into notepad and then copying and pasting into HTML view.

Code you copy from a website or email or any other formatted document can keep some of the formatting. Copying from notepad eliminates this problem.




jonance -> RE: fp2002 corrupts asp code (12/10/2002 15:16:49)

I tried both of these to no avail...it keeps snapping to one line. Anybody else have suggestions?

Thanks,
John




bobby -> RE: fp2002 corrupts asp code (12/10/2002 15:39:31)

Have you tried it as an include? Then FP can' t touch it...





jonance -> RE: fp2002 corrupts asp code (12/10/2002 15:43:11)

I have found that it only does it when i am pasting within a tag...which i am trying to do. I am trying to paste it into an image tag. You would think since i have the " allow line breaks within tags" box selected...then it would do just that. But it seems to do just the opposite. Looks like a fp2002 bug. Can anyone replicate it? I guess i' m s-o-l?

Thanks,
John




jonance -> RE: fp2002 corrupts asp code (12/10/2002 15:44:29)

How do you do an include?




bobby -> RE: fp2002 corrupts asp code (12/10/2002 15:47:50)

Save the code in a .txt file (in your root web - keep the <% and %>)

Then where you want it to appear in the page:

<!--#include file=" filename.txt"  -->


The server will parse the page (assuming it' s an .asp or .shtml page) and take whatever is in filename.txt and copy > paste it into the web page before processing script code... then it passes it to the browser.

Give that a shot and see if it works... that will at least eliminate non-FP possibilities.

Are you testing this on PWS or IIs?




bobby -> RE: fp2002 corrupts asp code (12/10/2002 15:49:22)

You' re trying to place it into an image tag? Where? How?

Can you post an example of what you' re trying to do?




jonance -> RE: fp2002 corrupts asp code (12/10/2002 16:53:47)

Trying to do the below code. it basically diplays the image that was just uploaded by a file upload script. But when i save...BAM...it puts it all on one line.


<p align=" center" ><img border=" 0" src=" <%
For Each File in Upload.Files
Response.Write File.extractfilename
Next
%>
" >




Spooky -> RE: fp2002 corrupts asp code (12/10/2002 16:57:39)

<p align=" center" >
<% Response.write " <img border=" " 0" "  src=" " " 
For Each File in Upload.Files 
Response.Write File.extractfilename 
Next 
Response.write " " " >" 
%> 


The user has only uploaded one file?




bobby -> RE: fp2002 corrupts asp code (12/10/2002 16:59:46)

Try using it like a function instead...

Set the file name to a variable and then response.write the variable name into the <img> tag... then you don' t have to worry about line breaks...

Also, why are you using a For Each?

If there is only one file there you shouldn' t need to do that... if there is more than one file then the image tag won' t work anyway... just curious, since I' ve never used this method myself... [:)]




jonance -> RE: fp2002 corrupts asp code (12/10/2002 17:04:24)

I was given that code snippet by someone who did a similar thing...i think he let you upload more than one. I don' t but didn' t know what to change. If someone could tell me how i could make it work for just one picture i would appreciate it...i don' t know too much asp (but am trying to learn).

Still, anyone know why it keeps snapping to one line?




Spooky -> RE: fp2002 corrupts asp code (12/10/2002 17:10:29)


<p align=" center" >
<% 
For Each File in Upload.Files 
Response.write " <img border=" " 0" "  src=" " " &File.extractfilename &" " " >" 
Next 
%> 





bobby -> RE: fp2002 corrupts asp code (12/11/2002 0:13:59)

brilliant.

and I' m not just saying that because you control my forum fate. [:p]




Spooky -> RE: fp2002 corrupts asp code (12/11/2002 0:23:05)

You' ve no reason to suck up at the moment, so Ill take that as a compliment. [;)]




jonance -> RE: fp2002 corrupts asp code (12/11/2002 17:58:08)

Well it happened again...and it WAS missing from GLOBAL.ASA file. Any thoughts on how to keep it there? Can i edit that file at all. I don' t want to do more damage. Any reason it might just disappear, with no update functions or anythign being used?




jonance -> RE: fp2002 corrupts asp code (12/11/2002 18:04:24)

In case it helps, here is the FP generated Global.ASA file WITH the code that works...is there anything askew you can see?

-------------------------------------------------------------------------

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
' ==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(11)
' --Project Data Connection
Application(" buttons_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/links.mdb"
FrontPage_UrlVars(0) = " buttons_ConnectionString"
Application(" buttons_ConnectionTimeout" ) = 15
Application(" buttons_CommandTimeout" ) = 30
Application(" buttons_CursorLocation" ) = 3
Application(" buttons_RuntimeUserName" ) = " "
Application(" buttons_RuntimePassword" ) = " "
' --Project Data Connection
Application(" editor_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/editor.mdb"
FrontPage_UrlVars(1) = " editor_ConnectionString"
Application(" editor_ConnectionTimeout" ) = 15
Application(" editor_CommandTimeout" ) = 30
Application(" editor_CursorLocation" ) = 3
Application(" editor_RuntimeUserName" ) = " "
Application(" editor_RuntimePassword" ) = " "
' --Project Data Connection
Application(" links_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/settings.mdb"
FrontPage_UrlVars(2) = " links_ConnectionString"
Application(" links_ConnectionTimeout" ) = 15
Application(" links_CommandTimeout" ) = 30
Application(" links_CursorLocation" ) = 3
Application(" links_RuntimeUserName" ) = " "
Application(" links_RuntimePassword" ) = " "
' --Project Data Connection
Application(" louisvilleguide_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/louisvilleguide.mdb"
FrontPage_UrlVars(3) = " louisvilleguide_ConnectionString"
Application(" louisvilleguide_ConnectionTimeout" ) = 15
Application(" louisvilleguide_CommandTimeout" ) = 30
Application(" louisvilleguide_CursorLocation" ) = 3
Application(" louisvilleguide_RuntimeUserName" ) = " "
Application(" louisvilleguide_RuntimePassword" ) = " "
' --Project Data Connection
Application(" items_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/items.mdb"
FrontPage_UrlVars(4) = " items_ConnectionString"
Application(" items_ConnectionTimeout" ) = 15
Application(" items_CommandTimeout" ) = 30
Application(" items_CursorLocation" ) = 3
Application(" items_RuntimeUserName" ) = " "
Application(" items_RuntimePassword" ) = " "
' --Project Data Connection
Application(" addalocality_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/addalocality.mdb"
FrontPage_UrlVars(5) = " addalocality_ConnectionString"
Application(" addalocality_ConnectionTimeout" ) = 15
Application(" addalocality_CommandTimeout" ) = 30
Application(" addalocality_CursorLocation" ) = 3
Application(" addalocality_RuntimeUserName" ) = " "
Application(" addalocality_RuntimePassword" ) = " "
' --Project Data Connection
Application(" publicmarketplace_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/publicmarketplace.mdb"
FrontPage_UrlVars(6) = " publicmarketplace_ConnectionString"
Application(" publicmarketplace_ConnectionTimeout" ) = 15
Application(" publicmarketplace_CommandTimeout" ) = 30
Application(" publicmarketplace_CursorLocation" ) = 3
Application(" publicmarketplace_RuntimeUserName" ) = " "
Application(" publicmarketplace_RuntimePassword" ) = " "
' --Project Data Connection
Application(" jobs_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/jobs.mdb"
FrontPage_UrlVars(7) = " jobs_ConnectionString"
Application(" jobs_ConnectionTimeout" ) = 15
Application(" jobs_CommandTimeout" ) = 30
Application(" jobs_CursorLocation" ) = 3
Application(" jobs_RuntimeUserName" ) = " "
Application(" jobs_RuntimePassword" ) = " "
' --Project Data Connection
Application(" events_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/events.mdb"
FrontPage_UrlVars(8) = " events_ConnectionString"
Application(" events_ConnectionTimeout" ) = 15
Application(" events_CommandTimeout" ) = 30
Application(" events_CursorLocation" ) = 3
Application(" events_RuntimeUserName" ) = " "
Application(" events_RuntimePassword" ) = " "
' --Project Data Connection
Application(" helpfullinks_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/helpfullinks.mdb"
FrontPage_UrlVars(9) = " helpfullinks_ConnectionString"
Application(" helpfullinks_ConnectionTimeout" ) = 15
Application(" helpfullinks_CommandTimeout" ) = 30
Application(" helpfullinks_CursorLocation" ) = 3
Application(" helpfullinks_RuntimeUserName" ) = " "
Application(" helpfullinks_RuntimePassword" ) = " "
' --Project Data Connection
Application(" maine_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/maine.mdb"
FrontPage_UrlVars(10) = " maine_ConnectionString"
Application(" maine_ConnectionTimeout" ) = 15
Application(" maine_CommandTimeout" ) = 30
Application(" maine_CursorLocation" ) = 3
Application(" maine_RuntimeUserName" ) = " "
Application(" maine_RuntimePassword" ) = " "
' --
Application(" FrontPage_UrlVars" ) = FrontPage_UrlVars
' ==FrontPage Generated - endspan==
End Sub
Sub Session_OnStart
FrontPage_StartSession ' ==FrontPage Generated==
End Sub
Sub FrontPage_StartSession
On Error Resume Next
if Len(Application(" FrontPage_VRoot" )) > 0 then Exit Sub

sFile = " global.asa"
sRootPath = Request.ServerVariables(" APPL_PHYSICAL_PATH" )
if Left(sRootPath,1) = " /" then sSep = " /" else sSep = " \"
if Right(sRootPath,1) <> sSep then sRootPath = sRootPath & sSep
sRootPath = sRootPath & sFile

' discover the VRoot for the current page;
' walk back up VPath until we match VRoot
Vroot = Request.ServerVariables(" PATH_INFO" )
iCount = 0
do while Len(Vroot) > 1
idx = InStrRev(Vroot, " /" )
if idx > 0 then
Vroot = Left(Vroot,idx)
else
' error; assume root web
Vroot = " /"
end if
if Server.MapPath(Vroot & sFile) = sRootPath then exit do
if Right(Vroot,1) = " /" then Vroot = Left(Vroot,Len(Vroot)-1)
iCount = iCount + 1
if iCount > 100 then
' error; assume root web
Vroot = " /"
exit do
end if
loop
' map all URL= attributes in _ConnectionString variables
Application.Lock
if Len(Application(" FrontPage_VRoot" )) = 0 then
Application(" FrontPage_VRoot" ) = Vroot
UrlVarArray = Application(" FrontPage_UrlVars" )
for i = 0 to UBound(UrlVarArray)
if Len(UrlVarArray(i)) > 0 then FrontPage_MapUrl(UrlVarArray(i))
next
end if
Application.Unlock
End Sub
Sub FrontPage_MapUrl(AppVarName)
' convert URL attribute in conn string to absolute file location
strVal = Application(AppVarName)
strKey = " URL="
idxStart = InStr(strVal, strKey)
If idxStart = 0 Then Exit Sub
strBefore = Left(strVal, idxStart - 1)
idxStart = idxStart + Len(strKey)
idxEnd = InStr(idxStart, strVal, " ;" )
If idxEnd = 0 Then
strAfter = " "
strURL = Mid(strVal, idxStart)
Else
strAfter = " ;" & Mid(strVal, idxEnd + 1)
strURL = Mid(strVal, idxStart, idxEnd - idxStart)
End If
strOut = strBefore & Server.MapPath(Application(" FrontPage_VRoot" ) & strURL) & strAfter
Application(AppVarName) = strOut
End Sub
Function FrontPage_FileExists(fspath)
On Error Resume Next
FrontPage_FileExists = False
set fs = CreateObject(" Scripting.FileSystemObject" )
Err.Clear
set istream = fs.OpenTextFile(fspath)
if Err.Number = 0 then
FrontPage_FileExists = True
istream.Close
end if
set istream = Nothing
set fs = Nothing
End Function
</SCRIPT>
<head><title>Web Settings for Active Server Pages</title><html xmlns:mso=" urn:schemas-microsoft-com:office:office" xmlns:msdt=" uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" >
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:connectionstatus msdt:dt=" string" >buttons=1 editor=1 links=1 louisvilleguide=1 items=1 addalocality=1 publicmarketplace=1 jobs=1 events=1 helpfullinks=1 maine=1</mso:connectionstatus>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>




Doug G -> RE: fp2002 corrupts asp code (12/11/2002 18:30:53)

Just wildly guessing, are you in some kind of Apache/unix compatibility mode? Or are you trying to cut & paste from html text files that were generated on a unix box? *nix files don' t like cr-lf, just lf as end of line characters.





jonance -> RE: fp2002 corrupts asp code (12/11/2002 18:41:28)

nothing i have done....is that for sure? I host on a windows server. All the other db connections work fine and are maintained...just the one titled " maine" is broken.

John




Spooky -> RE: fp2002 corrupts asp code (12/11/2002 18:48:48)

Does anyone else have edit / publish rights to the server?
Is someone perhaps working from an old copy?Its as if a cached copy is used or uploaded.

Another option, is to save this info below, directly into the page that calls that database. Then the variables will always be active.

Application(" maine_ConnectionString" ) = " DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/maine.mdb"  
FrontPage_UrlVars(10) = " maine_ConnectionString"  
Application(" maine_ConnectionTimeout" ) = 15 
Application(" maine_CommandTimeout" ) = 30 
Application(" maine_CursorLocation" ) = 3 
Application(" maine_RuntimeUserName" ) = " "  
Application(" maine_RuntimePassword" ) = " "  




jonance -> RE: fp2002 corrupts asp code (12/12/2002 8:58:38)

No, noone else works on the site. To insert the code above, do i need any tags before or after? Also, would i just put it at the very top of the page or does it matter? Again, i am new to actual asp coding.

Thanks,
JOhn




Spooky -> RE: fp2002 corrupts asp code (12/12/2002 13:01:08)

Yep, cut and paste the code into the very top of the page that first calls the DRW that queries that database

<%
Application(" maine_ConnectionString" ) = " DRIVER={Microsoft Access Driver(*.mdb)};DBQ=URL=fpdb/maine.mdb" 
FrontPage_UrlVars(10) = " maine_ConnectionString" 
Application(" maine_ConnectionTimeout" ) = 15
Application(" maine_CommandTimeout" ) = 30
Application(" maine_CursorLocation" ) = 3
Application(" maine_RuntimeUserName" ) = " " 
Application(" maine_RuntimePassword" ) = " "  
%>




jonance -> RE: fp2002 corrupts asp code (12/16/2002 14:17:44)

Hi Spooky and all.....i added that code to the top of the document at

http://mainebizguide.com/listtest.asp?category=Accountants

However, now i get this error:

Microsoft VBScript runtime error ' 800a000d'

Type mismatch: ' FrontPage_UrlVars'

/listtest.asp, line 3


Can you help?

Thanks,
John




Spooky -> RE: fp2002 corrupts asp code (12/16/2002 15:57:51)

I may have cut and pasted too much :)
You should be OK to remove :

FrontPage_UrlVars(10) = " maine_ConnectionString"




jonance -> RE: fp2002 corrupts asp code (12/16/2002 17:06:16)

I took out that line and it still didn' t recognize it as connected. I had to reconnect through frontpage b/c it is live. Here is what i put at the top of the page:

<%
Application(" maine_ConnectionString" ) = " DRIVER={Microsoft Access Driver(*.mdb)};DBQ=URL=http://www.mainebizguide.com/fpdb/maine.mdb"
Application(" maine_ConnectionTimeout" ) = 15
Application(" maine_CommandTimeout" ) = 30
Application(" maine_CursorLocation" ) = 3
Application(" maine_RuntimeUserName" ) = " "
Application(" maine_RuntimePassword" ) = " "
%>


Any reason that this didn' t open the database connection? Also, to clarify, i need to have this on the top of every page that calls that database right? The fp connection still keeps disappearing and i need something that will hold fast. Hope you can help. THanks,
John




jonance -> RE: fp2002 corrupts asp code (12/17/2002 0:57:15)

I am trying this on a diff. site now with a db connection that doesn' t matter so i can mess with it. I have disable the db connection " links" . here is the link:

http://yourcityguide.net/test.asp

Here is the code i have at the top:

<%
Application(" links_ConnectionString" ) = " DRIVER={Microsoft Access Driver(*.mdb)};DBQ=URL=fpdb/links.mdb"
Application(" links_ConnectionTimeout" ) = 15
Application(" links_CommandTimeout" ) = 30
Application(" links_CursorLocation" ) = 3
Application(" links_RuntimeUserName" ) = " "
Application(" links_RuntimePassword" ) = " "
%>


It says cannot find datasource name etc....any clues?

Thanks in advance,
John




Spooky -> RE: fp2002 corrupts asp code (12/17/2002 1:33:30)

Hmm - almost stumped.
If you make another simplae asp page, like so :

Connection = <% =Application(" links_ConnectionString" ) %>


Does the connection show on the page?
Is the code you have the very first thing within the pages code?
Im wondering if its not better to try a manual connection or DSN if all else fails.




jonance -> RE: fp2002 corrupts asp code (12/17/2002 9:43:19)

I created the page: http://www.yourcityguide.net/test_copy(1).asp and simply added that code to the very top. I am not sure exactly what i should see.

SInce this doesn' t seem to be working...unless you can crack why this wont work...is there any other failsafe method i can use. I definately need to use the drw which i still have in my page. I have the ability to set up dsn' s automatically on the server. Any method would be fine with me...i would just need to be walked through it due to my lack of experience with asp...but hopefully next time i' ll be able to walk someone else through it.

Thanks,
John




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.15625