2
votes

my "hello world" ASP.NET application works fine in debug. However, after I publish, I have issues :

  1. where do I control whether I want my website to serve Default.aspx or .asp as default page ? When I debug, it is calling Default.aspx with no problems, but after publish, it seems to request Default.asp

  2. why do I get this error when I request Default.aspx manually ? (in browser)

    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 'http://localhost/slidenet/default.aspx'. Line 1, ...

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

  3. if I don't request a page, it will call my Default.asp that I created on purpose, and again, same error : The page cannot be displayed There is a problem with the page you are trying to reach and it cannot be displayed.


Please try the following:

Click the Refresh button, or try again later.

Open the localhost home page, and then look for links to the information you want. HTTP 500.100 - Internal Server Error - ASP error Internet Information Services


Technical Information (for support personnel)

Error Type: Active Server Pages, ASP 0221 (0x80004005) The specified 'Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" ' option is unknown or invalid. /slidenet/Default.asp, line 1

Browser Type: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

Page: GET /slidenet/Default.asp

Time: 11 January 2012, 14:00:02

More information: Microsoft Support

4
probably a wrong IIS configuration, but you will have to give more info about the hosting environment. Best bet : default document set to default.asp in the iis config.Steve B
You need to change the order of document (welcome) pages from the control panel. Please specify the IIS version.kv-prajapati
I'm publishing on a Windows XP Pro 32bits as a "test publish". Looking to publish later on Windows servers 2008 64bits... I hope ASP.net is able to make abstraction of it.BuZz
I found out where to specify Default.aspx in IIS, but why do I get this error ?BuZz
You removed the first part of your question, but I have rolled back the question, because all the answers given below are for the first item in your question. By removing that from your question, nobody will understand why those answers were given. If you need further assistance with the rest of your issues (especially the second item in your list), please ask a new question as this will isolate each issue for others to look at and help you with.Michiel van Oosterhout

4 Answers

2
votes

Could be that aspx engine hasn't been registered correctly with IIS. The handlers for aspx are not present.

Try running aspnet_regiis -i (MSDN link) from the command line. It needs to be run from the directory of the version of the .Net framework you are installing i.e. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

I've seen this happen when IIS has been installed after the .Net framework so it doesn't have a chance to register

The default page is a setting in IIS for the website as explained in the other answers.

1
votes

The order of default documents matters, documents at the top of the list of default document have priority over those lower on the list. See the screenshot below (IIS 7): Default.asp (if present) will be served by IIS, even if default.aspx is present. This is only because default.asp is higher in the list.

enter image description here

Use the Move Up option to make default.aspx the default over Default.asp.

On Windows XP with IIS 6:

enter image description here

If you want to do it in web.config, you can clear the defaultDocuments setting first, before adding default.aspx:

<defaultDocument>
  <files>
    <clear />
    <add value="Default.aspx" />
  </files>
</defaultDocument>

Or remove only default.asp:

<defaultDocument>
  <files>
    <remove value="default.asp" />
    <add value="default.aspx" />
  </files>
</defaultDocument>
0
votes

If you're running it using visual studio "virtual" webserver you must rightclick on default.aspx and select "set as start page" in the solution explorer tab. If you're running it in a IIS environement you must select the correct start page from the proprieties dialog-box in IIS. I would also suggest a clean rebuild of your project (Build-> Clean [projectname])

-1
votes

add this code to your web.config

   <defaultDocument>
    <files>
      <add value="Default.aspx" />
    </files>
  </defaultDocument>

you can also check the default documents under IIS settings