What is the default startup page for ASP.net Projects - asp.net

I have an ASP.net project I'm working on (1st time in ASP.net) however I'm curious to know how I would find which page is the page Visual Studio launches when I start debugging. Each time I search for this answer all the results simply tell you how to SET the startup page and not what the startup page actually IS. Basically - "What is the entry point"?
Currently my 'Start Action' when viewing the Project Properties is set to 'Current Page'. While I realize I can set a specific page or 'Start URL' I'm wondering what does 'Current Page' refer to? Basically I'm looking to know where I find the first line of code that is run when I begin debugging.
My initial thought was that it is looking for an aspx file named default.aspx but since my project has two of these files named default.aspx I guess it's pointing to the one residing with my other project files that sit at the root of my project.
Is this correct?

I think there is two question you are asking.
Firstly, where is the entry point for your MVC application? Well your entry point for debugging MVC application would be Application_Start in Global.asax.cs file
protected void Application_Start()
{
}
Secondly, the Start Action is Visual Studio enables you to specify what happens when you run your application.
Current Page – Enables you to run the page currently open for editing in Visual Studio.
Specific Page – Enables you to set a particular page to run. You can set the page here or you can right-click a page in the Solution Explorer window and select the menu option Set As Start Page.
Start External Program – Enables you to run an external program.
Start URL – Enables you to request a URL. This option is typically used when building a Web Services application.
Don’t open a page – Enables you to do nothing.
You can change the start page to a particular page. For example, if you want to request the URL /Blog/Show/23 when your application starts, then you can enter this URL into the Specific Page input field.

Related

I can't find options for Select Master Page or Place code in separate file in VS2012

I installed VS 2012 on my work PC, and for the life of me when I go to add a new web form, I cannot see or find the 2 options for Select Master Page or Place code in separate file.
Any ideas on how i can find them?
I've just been fooled by just that for the past hour. What I've found is that the 'old' method of using the menu option 'Add web page using master' (or similar) has vanished, and been replaced by 'Content Page'. When you select this, you're then given the option of choosing a master page.
Incidentally, I don't get the option of starting a web site project, which may be why I'm not seeing this either.
You should have web form with master page in the add items?
Placing code in separate file is a different concept called code-behind. You will have an ASPX file and a cs / vb file which handles the events.
e.g.
Default.aspx
Default.aspx.cs
EDIT: Based on comment.
You may be using a Web Site on your laptop, but a Web Application in work. See Web Application Projects v's Web Site Projects.
Take a look at ASP.NET Web Site or ASP.NET Web Application?, this might also help in deciding which to use. Generally, I always go for Web Application.
You can use VS to convert from a Web Site to a Web Application, but AFAIK, you can't do it the other way round unless you create a new project and copy across the relevant parts - which could be a big job depending on the size of the site.

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"

Why is the w3wp.exe process looking on file system when an ASP.NET MVC controller is accessed?

Was just wondering if this was normal behavior as I'm fairly new to ASP.NET MVC. When I monitor the site usage via procmon I see the following:
7:19:17.0053886 PM w3wp.exe 3992 QueryOpen C:\www\inetpub\ControllerName.mvc\ActionName PATH NOT FOUND
(This site is setup to run on IIS6/MVC2 - the reason for the .mvc extention)
This is happening when the ControllName.mvc\ActionName URL is hit.
the .mvc extension is mapped to the ASP.NET runtime which processes the request using ASP.NET MVC engine. It does the following:
Starts the routing engine.
The "router" looks if the file in the request exists on the file system. If yes, it returns it to IIS which will render the static file.
If it does not exist, the ASP.NET routing executes appropriate actions.
So your log is the result of step 2 here. It is normally should not be performed.
I know one reason why it runs though: you have RouteExistingFiles set to true.
You need to check it to be set to false (which is the default).
One more observation is that w2wp looks for file in the root of inetpub, which means the application is located in the Root of the web site and not in the Virtual Directory.
If it is not true, then you should check the location of the application on disk and structure of the web site. Maybe there is just some collision.
Have you unticked the "Verify that file exists" box in IIS?
It's in the properties of the Website -> Home Directory -> Configuration -> Wildcard Application maps -> your existing aspnet map
Unfortunately, the screenshot on the Microsoft page has the box ticked while the text says "Uncheck the checkbox labeled Verify that file exists"

Debugging an ASP.NET page with QueryString values

I am trying to debug an asp.net web form that requires a value from the querystring. I just want to debug that page without having to go through the entire process to create the querystring value and sending the request.
Any suggestions on how to attach a querystring value in VS2008 when I start the debugging process.
NOTE: I do not want to hard code the value in the pages code behind.
Visual Studio has an option to select which page to start when debugging.
It's under Properties -> Web -> Start Url
There you can enter the exact url you want.
Woot, this helped me greatly!
Simply right-click on your web project from the solution explorer, click properties (or alt-enter), click the Web left-side-tab, and set a specific start page (including your qs param)!

Resources