views:

561

answers:

4

Hi,

I've created a new Web Site on VS2005. An ASPX file was created.

when I run the file in VS, it opens via IE and an ASP.NET Development Server icon appears near the clock.

when I try to run the aspx file in IE, I get the error:

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. 

A name was started with an invalid character. Error processing resource 'file:///C:/Documents and Settings/odedk/My Documen...

<%@ Page Language="VB" AutoEventWireup="false"%>
-^

What can be the problem?

+3  A: 

It seems like you opened the .aspx file on your hard disk with IE.

You need to open the page via the local server (localhost).

To do this, simply enter http://localhost:PortNo/ in your address bar where PortNo is the port number given by the ASP.NET Development Server.

thephpdeveloper
that's correct. but eventually I'd like to put it on a server under a domain. it will have a URL and it still won't work...
Oded
+2  A: 

You cannot open an aspx file directly in the browser.
It has to be on the IIS, where the server parses it, run it, and generates meaningful HTML.

The easiest way to do that is (on IIS 6):

  1. Open the IIS. (Control Panel > Administrative Tool).
  2. Go to Web Sites > Default Web Site.
  3. Right Click on Default Web Site, select New > Virtual Directory.
  4. Give it a name (Test) and the path to your files (the root, where you have your web.config).
  5. Check the Run Scripts box.

That's it. Now you can right click on the aspx file on the right, and browse it.
(If it still doesn't work, common problems are ASP.Net not defines, and sometimes windows authentication)

Here's a post with much more details: http://www.iisworkstation.com/2008/06/how-to-create-website-using-iis-6-level.html

Kobi
can you explain further how to set the IIS ?
Oded
+2  A: 

An Aspx page needs to be processed by the web server - either IIS or the web server built into Visual Studio. You can't just browse to it in the file system, double-click on it and have it work.

Instead, in Visual Studio, use right click on the aspx and choose "Set as start page".

Then start the debugger by hitting F5 or the Start Debugging" button.

Edit - added it sounds like you need to know the basics of web development and server-side technology in general, and Asp.Net specifically a bit better.

Here's a very good place to start for beginners.

http://msdn.microsoft.com/en-us/beginner/bb308772.aspx

David Stratton
there is no option "Set as startup object"
Oded
Are you right-clicking onthe file in the file system, or in Visual Studio?
David Stratton
in Visual Studio, right-click on the aspx file.
Oded
Sorry, how about "Set as start page". Is that there? And if there is more than one project in your solution, you would need to ensure that the project (or web site) that the aspx file is in is set as the startup project.This aspx page IS in a web site project, not a Class Library or a Windows Forms or WPF proect, right?
David Stratton
I built a simple aspx page that simply says "HELLO WORLD".nothing works. I copied it to our server where I have IIS installed. nothing works.
Oded
Did you watch the video(s) at the link I posted?
David Stratton
+1  A: 

You may need to run aspnet_regiis.exe from \windows\Microsoft.net\framework\.

http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

Brian Schantz