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.
Related
I need some help, I have purchased a domain and I am using visual studio to publish the website via FTP. It publishes successfully but when I go into the website I get the Directory Listing Denied error, and I am assuming that this is due to the fact that there is no home page because when I go the address and append /Page.aspx to the address it works fine.
Is there any way that I could set the default page for the website I am publishing to point to the default page?
Please help.
Thanks in advance.
Easy answer: rename your default page to Default.aspx.
Or, if you have access to IIS configuration settings, you can specify the default documents.
YOU need to spesify what page you want to use as your default based on the iis Default Document
You should have access to a ISP control panel where you can specify the default page.
They are usually the same pages in most ISPs:
Default.aspx
Index.aspx
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.
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"
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.
I want to display index.aspx instead of default.aspx in the root of folders in my ASP.NET app but can't figure out where to set this.
This is a change that you need to make in IIS. Please see Setting Up Default Documents for how to do this:
You can establish a default document
for client requests to a Web site that
does not specify a document name.
Default documents can be a directory's
home page or an index page.
It should be called "Default Document" in your IIS setting.
Here is how to do it in IIS 6 http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/dc6eb1b4-9028-4308-9935-52b64edfad36.mspx?mfr=true
In IIS Manager, right-click the web site and choose properties, click the 'Documents' tab, and add index.aspx to the list.