PDA

View Full Version : unable to open ASP pages in Windows explorer


brothercake
03-13-2003, 11:25 AM
I'm unable to open ASP pages locally in Win 2K. Resetting the registered file type sets it to open with Photoshop; using "open with" opens IE but the page is blank.

Is it possible to view .asp pages directly through windows, rather than through a server?

Spudhead
03-13-2003, 11:35 AM
You can't double-click an ASP file in Windows Explorer to view it, as you would an HTML file. The file contains code that needs to be passed (parsed) through a server - IE isn't going to be able to make sense of it on its own. You're either going to end up with a page of nonsense, or nothing.

The best I think you can do is to make ASP files open by default in Notepad or your code editor; you'll at least be able to double-click themn and get something meaningful. You're not going to be able to get them to display properly without running them through a server.

brothercake
03-13-2003, 11:42 AM
I understand that - display properly is not an issue; but display at all is ...

The page I'm dealing with has very little ASP in it - it's mostly static HTML - it's not even my job to maintain it (our company intranet), but I'm occassionaly asked to make small HTML/CSS/JS modifications, and that's why I need to be able to look at them this way.

So it doesn't matter that the ASP is unparsed; I just want to be able to open the page and view the static code output. But it doesn't work; even if I get an entirely static HTML page and rename it to .asp, the same thing happens.

raf
03-13-2003, 12:09 PM
spudhead is right. a file with extension .asp needs to be parsed by a webserver.
if you want to see the code, open it in notepad. if you want a designer view, open it in GoLive or Dreamweaver or whaterver.The html will be shown, but the asp code will be displayed as <%ASP%> (at least in GoLive)
If you dont have these soft (good on you !) then open them in the Microsofot Development Environement. (look for mse.exe on your harddisk or instal it from Ofice Pro CD).
Or just change the extension to .htm and then open them in IE or whatever browser. The asp will be ignored so you might see a normal html page with some lacks (if any), or you could get rubbish (depending on the asp code in the file)
Don't forget to rename the file after you're done with it.

edit:
with ignored, i mean ignored by the browser. The full source (asp, html, js, ...) will be send to the browser. So the asp will show up in the source (browsersided) but everything between asp tags (<%%>) will be ignored by the browser.

brothercake
03-13-2003, 12:18 PM
Originally posted by raf
The asp will be ignored so you might see a normal html page with some lacks (if any), or you could get rubbish (depending on the asp code in the file)

That's what I want - but without renaming the file (I mean I can, but I'd rather not); this works with .php - why is asp any different?

raf
03-13-2003, 01:38 PM
why are you making it so hard on yourself?
you have several option:
- view the code in notepad or wordpad
- view the design/code/preview in Dreamweaver, Adobe GoLive, MSE, Frontpage ... (previewing will result in a file that looks just the same as when you change the extension to .htm)
- change the extension
- copy it to a virtual directory (a new or existing one) and open it in your browser (typing in the url)
I'm not sure what other options you need.

Why it can't be done like PHP: asp files always need to be parsed by the right scripting engine. (see previous posts)
Thats also why you can only serve them with IIS (unless you use Perl as a scripting language cause then you also have a scripting engine
for appache). With asp, you need to change the extension if you want the aspcode to be parsed.
And the webserver needs an http request (request from the browser) before it loads and parses the asp file.

I'm not sure how PHP gets processed, buth PHP code can be parsed inside .htm or .html files (with appache, don't know about IIS or others)
so you don't need to set the extension to .php if it contains php. This means that the file can be processed like an html-file and that the scripting engine can be called lateron when the <?php tag is encountered (not a big problem since php usually runs as an Appache module)
With asp, the right scriptenginge needs to be initiated before the code is parsed. (It will be the default scripting engine, which you can change with @ LANGUAGE)

But i don't suppose this makes you hot or cold (it doesn't work for me)

Anyone else?

brothercake
03-13-2003, 01:56 PM
PHP is not implictly parsed - the server is configured by directive to parse files with a particular extension through a particular module - is IIS/ASP different from that?

What I meant was that I can go "file > open" and locally-view a PHP file, and the static code is displayed along with unparsed PHP. The same, but an ASP file, is blank.

Why am I making it harder ... because I don't have any of the dev environments you mentioned; this isn't my thing at all; I'm used to PHP and Apache, where everything's plain-text documents in Textpad and tested using a local version of Apache. I've never used FP, DreamWeaver or any of those packages, and I don't have an IIS server.

Editing the source of ASP docs is no problem; the problem is that I want to be able to look at them, without doing anything special.

Anyway nevermind - thanks for all the suggestions; I guess renaming to .htm is the easiest thing for now :thumbsup:

raf
03-13-2003, 02:04 PM
well, there you see what's the difference.

Did you search form mse.exe ? It's worth installing if you occasionaly work with asp. It's the perfect and free editor for writing asp's, even if you only use the code-view.

brothercake
03-13-2003, 03:22 PM
Originally posted by raf
Did you search form mse.exe ?

No I didn't, but it sounds like a good plan; thanks :)