Hi,
this is really a beginner question:
when I start debuging an ASP.net projet in VS, IE opens up to display the Default.aspx webpage and the following URL is in the adress bar: http://localhost:52480/Default.aspx. My page including C# codebehind controllers works fine. If I stop debbuging and I try to double click on Default.aspx from the Windows explorer then IE opens up but gives me and XML error message for line 1 column 2 of my Default.aspx witch is the first line where I declare the laguage used for code behing, AutoEventWireup and so on. So I wonder why can't I open an aspx page by just double clicking on the icon. I also copied all the project folder to \wwwroot (iss) and I tried to open the same page on a second PC (on the same LAN) specifying the IP adress of my server. Now the page commes up but when I click on a controller (a button for instance) I recieve a Run Time Error from IE. Can some help me understand what is the diffrence of opening a aspx page while debbuging and trying to open it by double clicking on the icon. I also want to be able to get the page to work from the client PC.

Thanks

Recommended Answers

All 2 Replies

The purpose of an Aspx page is to run at application server, and not to be viewed using browser.

Reason you are getting error on opening the aspx file on browser is because the browser finds that the Aspx does not confirm to regular XML standards.

1. You can remove the Page directive( line begining with <%@ )
2. You can remove the DOCTYPE declaration.

http://www.javascriptkit.com/howto/doctype.shtml

Now your aspx should look like plain XML ( between <html> tags) , which you can view on the browser.

The aspx is run at server and an is HTML generated which is showed on an browser when you open through VS.

And when you open it directly from a browser, it is considered as plain XML.

Thanks,
Chithra

When you run the default.aspx from VS, actually the page is running in a built-in web server of VS 2005/2008 called cassini wev server so that you are able to view in IE.

But if you try to open the .aspx directy from IE through Windows Explorer, the .aspx file will be treated as an xml file and IE will try to parse it.

You can view the .aspx pages from your PC or other PC from network only after deploy your application in IIS.

A simple way to deploy your asp.net application in IIS in Windows XP is right click on the folder in Windows Explorer->Properties->Web Sharing->Share this folder->Enter Alias Name->Press Ok.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.