Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > ASP What?

ASP What?
Thread Tools
Mac Elite
Join Date: Dec 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Sep 16, 2002, 03:10 PM
 
I have to redesign a website, but the whole thing is written in ASP. Anyone knows more about this? I know php, html but no ASP. There is a little database set up on that site, and lot of server functions. Is this some MS format, that is not compatible with anything else out there?

When I look at the source of the site it looks awful. No html beginnings ending....bla bla bla...so I wanted to redo it, but I need to know how to import it, what software writes ASP code?
Anything I should be aware of when using ASP?


Thank you,


t
     
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Sep 16, 2002, 03:43 PM
 
Good news is that ASP is pretty much similar to PHP, once you learn the syntax you're away.

Bad news is that it sounds like the site's been made with Frontpage. The code Frontpage throws out makes anything that Dreamweaver produces look like child's play.

Good luck.
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Sep 16, 2002, 11:45 PM
 
Originally posted by t_hah:
Is this some MS format, that is not compatible with anything else out there?
yes, and yes. in a way. it only runs on M$ boxes, and that database is 99% certain to be an Access one. the only way you'll be able to develop that stuff on your mac, is via VPC.

you mentioned php, so maybe you'd care to check this out. i've not used it, but it looks like it might help you out

good luck
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Sep 17, 2002, 12:51 PM
 
ASP isn't a language, it just means it's a page containing code to be executed by the server. It is supported by both IIS (duh) and also Apache I think. It is somewhat similar to PHP I guess. I don't really have experience in either technologies but that's what I understand. Ninenty nine times out of ten the language used in ASP pages is Visual Basic.

If you can figure out how to hook into their database you could easily redo the site in PHP.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Santa Fe
Status: Offline
Reply With Quote
Sep 17, 2002, 06:01 PM
 
Originally posted by philzilla:
...that database is 99% certain to be an Access one.
On a production server? I certainly hope not. It's pretty common to see ASP used in conjunction with MS SQL Server, though.

Originally posted by Scarpa:
Ninenty nine times out of ten the language used in ASP pages is Visual Basic.
Actually VBScript, a subset of Visual Basic.
     
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Sep 20, 2002, 10:05 PM
 
Do the business owner of the web a favor and don't touch it. Let someone with ASP experience work on it.
     
Fresh-Faced Recruit
Join Date: Jul 2002
Status: Offline
Reply With Quote
Sep 29, 2002, 05:41 PM
 
I'm switching over to PHP/Postgres (mysql BLOWS). You can convert some ASP code over to PHP but only assuming it was written in generic vbscript or jscript. The same structures are the same except there are some things to look out for.

IF... A BIG IF. If they are using COM components, you can't really convert to PHP. Some of the things I've done in the past that use COM CAN not and WILL not be transferrable to PHP. COM objects are usually server-side objects and many ASP developers use them. Either make their own COM or buy COM objects from others to simplify tasks. For example, I have sites that does encryption, PDF generation, dynamic image resizing using ghost-script/imagemagick, zip compression and so forth. To do it in PHP, I would have to start from scratch and do work-arounds. The whole thing would have to be written over.
In some case, if the COM ibject interfaces with an App server, you cannot convert PHP over to a different environment -- e.g. Unix/OS X. PHP on window supports COM but not transactions.

As someone else noted.. If you don't know ASP, its best to let someone else who has experience doing it.
-
     
Registered User
Join Date: Sep 2002
Location: New York City
Status: Offline
Reply With Quote
Oct 18, 2002, 03:24 PM
 
Originally posted by t_hah:

When I look at the source of the site it looks awful. No html beginnings ending....bla bla bla...so I wanted to redo it, but I need to know how to import it, what software writes ASP code?
Many times people will develop a dynamic web site with two types of web pages: 1) interface 2) processing. The (1) page is used to present or gather information from the User. The (2) page is used to process the User's input by performing business logic, calling stored procedures, doing database updates/inserts, etc. . Having said this...if the ASP page that you're looking at does not have any HTML tags then that page is likely being used to do a process. When the process is complete it would redirect the user to another page of type (1) or (2).

(you can use ASP to dynamically "write" html tags into a page, but it often leads to cryptic code, so it's usually easier to just have html tags with ASP doing any dynamic content generation.)

Generally, ASP(activer server pages), JSP (java server pages), PSP(server pages for Oracle web server, like 9iAS), and PHP....they all have a very similar paradigm for web site construction. If you know one, you are in great shape to do another.

Originally posted by t_hah:
what software writes ASP code
I usually write HTML and ASP code by hand in Notepad. On the Mac, BBEdit is a good editor. Sometimes I will use FrontPage or another WYSIWYG to build the HTML "skeleton" of the site, and then put in logic or the code by hand.

Good luck.
     
Registered User
Join Date: Sep 2002
Location: New York City
Status: Offline
Reply With Quote
Oct 18, 2002, 03:43 PM
 
Originally posted by t_hah:

When I look at the source of the site it looks awful. No html beginnings ending....bla bla bla...so I wanted to redo it, but I need to know how to import it, what software writes ASP code?
Many times people will develop a dynamic web site with two types of web pages: 1) interface 2) processing. The (1) page is used to present or gather information from the User. The (2) page is used to process the User's input by performing business logic, calling stored procedures, doing database updates/inserts, etc. . Having said this...if the ASP page that you're looking at does not have any HTML tags then that page is likely being used to do a process. When the process is complete it would redirect the user to another page of type (1) or (2).

(you can use ASP to dynamically "write" html tags into a page, but it often leads to cryptic code, so it's usually easier to just have html tags with ASP doing any dynamic content generation.)

Generally, ASP(activer server pages), JSP (java server pages), PSP(server pages for Oracle web server, like 9iAS), and PHP....they all have a very similar paradigm for web site construction. If you know one, you are in great shape to do another.

Originally posted by t_hah:
what software writes ASP code
I usually write HTML and ASP code by hand in Notepad. On the Mac, BBEdit is a good editor. Sometimes I will use FrontPage or another WYSIWYG to build the HTML "skeleton" of the site, and then put in logic or the code by hand.

Good luck.
     
Fresh-Faced Recruit
Join Date: Sep 2002
Status: Offline
Reply With Quote
Oct 18, 2002, 05:13 PM
 
If you're a PHP programer and have to write ASP pages think of using JScript instead of VBScript. The syntax and approach of JScript has much more in common with PHP and you'll be able to adapt faster. The downside is more online tutorials for ASP are written with VBScript but that's not a big deal if you already know how to program.

If you have to work on an existing VBScript site then you will quickly learn to hate the language. I plan on turning down any future VBScript jobs.

If they are using COM components, you can't really convert to PHP. Some of the things I've done in the past that use COM CAN not and WILL not be transferrable to PHP.
If you are converting an existing ASP site to PHP then the it's true that the biggest hurdle will be the use of commercial COM objects. They are typically used in ASP sites for functions like emailing from a script or graphing. Most such features are either built in to PHP or available as free scripts so you usually aren't so much translating the code as rewriting it. The functionality can be transferred.

You can run ASP on Unix servers with a commercial tool from Sun. Formerly called ChiliSoft ASP it cannot run Windows COM objects so it isn't usually an easy task to move existing sites to it and there's little reason to use it for new development since you can use PHP or Java for free and not have to pay for COM objects that mimic free functionality in other languages.

The ASP Apache Module is not compatible with VBScript or JScript. It uses Perl in an ASP like way.
     
Professional Poster
Join Date: Dec 2001
Location: somewhere
Status: Offline
Reply With Quote
Oct 26, 2002, 08:39 AM
 
ASP != Access. It more likely means MSSQL. Either way, the DB code is straightforward. VB (and VBScript) is a fairly non cryptic language (I've never seen anyone do ASP in JScript). You should be able to tell what the code is doing. If not, it was a poor programmer that wrote it.

There is a program called ASP2PHP (you can probably find it here). It will convert ASP code to PHP. However, let me just guarantee you that database code will not be properly converted.

There are three things you need to figure out about the ASP. You need to figure out what is being read from or written to the database. You need to figure out any calculations or processing that is happening in ASP (or in a COM Component - server.CreateObject("Object.Class")). You need to figure out the HTML layout (should be the easiest part of all).

The DB code is simple - you can use the same SELECT/INSERT/UPDATE statements (PHP does MSSQL just fine). If you see a block of code that looks like:

sql = "SELECT Column1, Column2 FROM Table WHERE Column3 = " & iVar3
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, strConnect, adOpenKeyset, adLockPessimistic
rs("Column1") = iVar1
rs("Column2") = iVar2
rs.Update
rs.Close
set rs = Nothing

that is basically an update statement. Your update would look like:

"UPDATE Table SET Column1 = ".$iVar1.", Column2 = ".$iVar2." WHERE Column3 = ".$Var3;

The stored procedure code can get somewhat ugly if they used output parameters. There are about four different ways to go about that code and none of them are pretty (CreateParameters and Append statements with a bunch of parameters...). You should be able to see what is going on. Just look at the SP in the DB and see what it looks like and figure out how you need to be calling it from PHP.

As far as the logic goes, ASP has fewer built in functions that PHP. This goes for strings, arrays, etc. It should be easy to tell what the programmer was doing. If you have access to the code, and you can fiddle, here are a few things to try:

At any point you want to see what is in a variable (to track changes to it through the code), you can do Response.Write "Var1 is " & iVar1 & "<br>". If you want to stop the page from processing at a particular point, do a Response.End.

If you see Server.CreateOject("Object.Class") and Object is something other than "ADODB" (ADODB is the DB stuff), you need to find out what that is and where they got it. It may just be something that they wrote in VB and compiled into a DLL. If so, just mimic the functionality in a PHP class. If not, find out what they use it for and try to find a substitute for PHP.

Request is the method of reading cookies, form values and querystring values. Request.Cookies(), Request.Form() and Request.Querystring() will specifically read from Cookies, Form or Querystring. Request() will read for the passed variable name from all three at once.

They are very similar languages - you should be able to figure it out fairly well.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2