0

我做了一个Asp.net项目,当Default.aspx文件在Windows中通过Internet Explorer打开时报错。如下:

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:///G:/My Programming/Asp/My Project (90)/Defa...

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
-^
4

1 回答 1

1

The root cause of this problem is here:

file:///G:/My Progr.....

The problem is that the browser is looking directly at the source code file on the network.

In order for ASP programs to work, they have to be run by a web server; by accessing it directly on the G: drive, you're bypassing the web server, so the program isn't actually being run at all.

What you're seeing is the result of the browser trying to interpret the program source code as if it were XML. It isn't XML because it contains program code, so the browser is complaining about that.

To fix this, you need to access it via a http:// address, not a file:/// address.

The HTTP address must obviously be valid, which means you need to have a web server running. You haven't given us any detail about whether you have this or not, but that's what you need.

Hope that helps point you in the right direction.

于 2012-07-15T06:15:25.603 回答