Newbie starting problem

P

paul.richards

Hi,

If I create a file with this content:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html>

And save it as aspx, when viewed in Internet Explorer it just looks
like:

- <html>
- <body bgcolor="yellow">
- <center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html>

However, if I view http://www.w3schools.com/aspnet/firstpage.aspx it
shows:

Hello W3Schools! (with a yelow background).

Its the same file - what's the difference?
 
E

Eliyahu Goldin

What you view in IE from http://www.w3schools.com/aspnet/firstpage.aspx is
the html output of an aspx page. The aspx page itself looks absolutely
differently. The whole idea of server-side web programming is to transform
server-side code to client-side html. It doesn't make sense to save the html
as an aspx page. It is like you save an object file produced by a compiler
as a source file.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
D

David Wier

By choosing File/Open, you're doing nothing more than opening a local
file....for HTML files, that works fine, but ASP.Net files are server side
files/pages, which must be viewed in the same way you'd view a normal web
page, on the internet, with the full http....url
 
M

Mark Rae

Hi,

If I create a file with this content:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html>

And save it as aspx, when viewed in Internet Explorer it just looks
like:

- <html>
- <body bgcolor="yellow">
- <center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html>

However, if I view http://www.w3schools.com/aspnet/firstpage.aspx it
shows:

Hello W3Schools! (with a yelow background).

Its the same file - what's the difference?

In the first case, you are simply viewing the contents of the aspx file

In the second case, you are asking IIS to process the contents of the aspx
file and render it as HTML for streaming down to the browser...

If you open an Excel workbook in Notepad, all you will see is (what looks
like) garbage - now open it in Excel and suddenly is looks the way you would
expect...

Does that make it any clearer...?
 
M

Mike

Hi,

If I create a file with this content:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html>

And save it as aspx, when viewed in Internet Explorer it just looks
like:

- <html>
- <body bgcolor="yellow">
- <center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html>

However, if I view http://www.w3schools.com/aspnet/firstpage.aspx it
shows:

Hello W3Schools! (with a yelow background).

Its the same file - what's the difference?

Put your file in the C:/inetpub/wwwroot folder and open your browser and
navigate to http://locahost/firstpage.aspx
 
P

paul.richards

I have placed the same file inside a virtual directory, created with
IIS - and it opens as it should.

Thanks, people.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top