Debugging an ASP.NET page with QueryString values - asp.net

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)!

Related

What is the default startup page for ASP.net Projects

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.

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.

how to remove default.aspx as default page from my application

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.

What can cause ASPNET AJAX page to revert to normal ASPX mode ? / UpdatePanel broken

I am using VS 2008 with a very simple UpdatePanel scenario.
But i cannot get UpdatePanel to work and cant seem to find out why
I have in fact reverted to a very simple example to validate it is not my code:
http://ajax.net-tutorials.com/controls/updatepanel-control/
In this example I click on either button and both text links update.
I dont get any errors, the page just behaves like a normal ASPX page.
What things do i need to check. I've been googling this for an hour and not found what I need.
Edit: Works in Visual Studio web server but not in IIS
If it's working locally, but not when deployed to a remote server, that usually indicates that you're using ASP.NET 2.0 and the ASP.NET AJAX extensions aren't installed on the remote server.
If it's a server you have administrative control over, you can download the installer here: http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en
If it's a web host, tell them to get their act together.
Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.
-Edoode

Resources