View ASPX page in web browser

I have the following .aspx page and I want to view it in web browsers like IE or Google Chrome by opening them directly in those browsers:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>

      

But somehow browsers cannot render it. In IE error

Unable to view XML input using XSL style sheet. Correct the error and then click the Refresh button or try again later. The name was started with an invalid character. Error handling resource ': /

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

      

What have I done wrong?

0


source to share


3 answers


Remove or comment out

< %@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>



because the browser doesn't know what to do with it. This is usually interpreted by iis and not sent to the browser.

+3


source


It will not work fine if it is not "served" by some web server.

If you are using Visual Studio, run the debugger, which will open IE by default, then take the url from the location bar and paste it into the browsers you want to test. Also, mount the website in IIS and view it that way.



Simply opening the source file in a browser will probably not give you the result you are looking for.

+1


source


Recent Visual Studios (at least 2010+) have a new feature called Browser View that you can run in an .aspx file. Note that according to the documentation, breakpoint debugging has no effect even if debugging is enabled.

Right-click the file in Solution Explorer or Editor and then select View Browser (your default browser is here).

Key combination: Ctrl+ Shift+W

0


source







All Articles