how to remove default.aspx as default page from my application - asp.net

I have changed Home.aspx to the default page but still when I run the app it is still going to default.aspx page. When I delete the default.aspx page and then I run it gives an exception that page not find (not 404 page not found). In some other page when I click on Grid row it should fire a grid row command but it calls default.aspx page first and then it fires the row command event. There is a connection between row command and default.aspx page, no response.redirect event from javascript but I don't know why it is calling DEFAULT.ASPX page.
Problem occurs only in IE
I have already set Home.aspx as default page but still it is searching for Default.aspx page at startup (Visual Studio).

If it is only problem in IE and works fine on other browsers, then consider clearing the cache of IE. Then do a hard refresh(CTRL+F5) of your web page.
Please recheck that you have mentioned the default document in web.config file.
If you are in hosting environment,then please select the default file from IIS setting for start pages from the control panel.

*If you have already tried right clicking the page and selecting Set as Startup Page , Did you checked in Visual studio site property pages, in start options list item there is "Start URL" and specific page properties. try changing these values ?
Did you checked if you are using built in asp.net URL routing or any other URL routing modules,handlers etc?
PS: if you are using web application project rather than web site project this setting is [yourapp]>properties>web>StartAction>StartURL

If you are using any javascript or jquery, please check that any default redirection (like ~/ or /) is there.

Related

Classic ASP start page not found (404) in IIS 7 on Windows Server 2008 R2

My site/application points to a folder called "site" with all permissions set up.
In that folder resides "home.asp".
Default document is "home.asp".
When I go to the domain, I get a "page not found".
If I capture that 404 error in IIS and tell it to redirect to "home.asp", everything works.
The problem with that is I don't want to redirect all 404's to home.asp.
I want the site to default to home.asp and find it.
Any ideas why this is happening?
Do I need to do something to the .Net side of things to tell it to
use the .ASP side of things by default?
Do I need to create a .aspx default page that redirects to my
"home.asp"? If so, what do I name that page?
As Diodeus indicated you should not try to redirect to a default page with a custom 404 error page that redirects, but rather by making sure your "home.asp" is added to the list of default documents within IIS.
This is thus an IIS configuration issue.
For instance for setting up default documents in IIS 6.0 this would be:
In IIS Manager, double-click the local computer, right-click the individual Web site folder, and then click Properties.
Click the Documents tab.
Select the Enable default content page check box.
Click Add to add a new default document to the list. (For you this would be your "home.asp")
Optional: Click the document you want to remove from the list and click Remove.
Click a document from the list and click Move Up or Move down to change the order in which default documents are served to client requests.
Click OK.
(From http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/dc6eb1b4-9028-4308-9935-52b64edfad36.mspx?mfr=true)

setting default page in asp.net app

We have a asp.net app, in which index.aspx is the default document in the website, instead of default.aspx.
Index.aspx is set as start page in the project too. but when I am trying to open for example: http://localhost:2265/, 1st I was getting the default.aspx page, after I removed the default.aspx file from the solution, now I have the directory listing displayed.
I would like to get index.aspx when I am entering http://localhost:2265/, is that possible to be set in the project or only in IIS?
Thanks in advance and happy holidays, Laziale
This is controlled from the server, which could either be IIS or the development server that's bundled with Visual Studio.
If you're launching the app from within Visual Studio, then the controls can probably be found under the properties of the ASP web site/app that you're launching. You could also right click the page itself and select "Set As Startup Page".
All of this doesn't affect the behaviour of the app once it's hosted in IIS, however. You'll need to find similar settings in the IIS page - there should be many a tutorial on the web for that (I can point you to one if you're having trouble).
Hope this clears up the behaviour of default pages!
Just open your solution in VS, then select the page you would like to be the startup page and do a right click and select 'Set As Start Page' option
In your project right click on the page you want to be your landing page and click "Set as Start Page".
This will only work when you run it from Visual Studio though. If you want to do it once it's deployed you will have to use IIS or setup a redirect I believe.

I get website files list

when I try to view ASP.NET website in browser I get the full list of files in the website folder. What could be the reason?Is there only one reason or there might be a lot?
That could happen if you have not specified a start page for your web application.
Right click on the web page you want to use as the default page and choose "Set as Start Page" whenever you run the web application from Visual Studio, it will open the selected page.
Refer to the following:
Set Default Page in Asp.net
Setting the default page for ASP.NET (Visual Studio) server configuration
EDIT:
If you are launching the site from within Visual Studio, you can set the default page by doing the following:
From this SO question answer
Right click on the web page you want
to use as the default page and choose
"Set as Start Page" whenever you run
the web application from Visual
Studio, it will open the selected
page.
You need to specify on the server (in IIS) what the default page is, and disable directory listing for the site.
See also:
Setting the default page & disabling directory browsing in ISS / Web.config
It could be any of the other cases mentioned in the answers OR
IIS by default looks for these files in the directory to serve in the given order if no file is specified.
Perhaps you have not specified a file, and turned on "Directory Listing"

"Set as start page" and index.html

If I set page "MyPage.aspx" as the start page, do I also need an index.html file?
Thanks.
Setting a page as a start page in Visual Studio only affects what page is loaded when you launch from the VS IDE. You'll have to configure IIS when you deploy if you want "MyPage.aspx" to be the default page that loads once your site is in production.
No you don't need, but you need to set your start page "MyPage.aspx as startup also on IIS.
As the above said , simply no. setting default page from IDE will automatically make it as default page. Only you have to do some settings in IIS that is from the properties of the web application, go to the tab where the default pages are displayed. Add the name of the page you have set from the VS IDE.

asp.net webpage defaultDocument button click not firing

I have developed an asp.net website in VS2010. The defaultDocument is set to default.aspx in the root directory, as I have dome many times before.
For reasons unknown an asp:button in default.aspx is not firing correctly when the url is typed in without the file extension.
For example, if I type the url www.mywebsite.com the default.aspx page will load as expected, however, the button will not fire (it does postback but doesn't fire the server click event).
If i type in the url www.mywebsite.com/default.aspx it works as expected.
The problem I'm having only occurs in a live environment (I cannot recreate the error on the localhost).
Any idea's?
Sorted this out last night. It turned out it was an HttpModule of the Telerik web controls I use, in the web.config.
RadCompression... (or something similar). It compresses and cleans up code after an ajax response.
I have no idea why it was affecting the defaultDocument only, but removing it solved my problem.

Resources