ASP.NET javascript debugging does not work in 2 projects - asp.net

I have 2 asp.net web applications, one of which is the main application and the second one is referencing the first application for like master pages , themes etc, and the main frameset that will point to the second application's webform based on database values (menu generated from database);
All my actual forms are in the second application, but the problem is when I set a breakpoint on the javascript file on my second application, it doesnt go into the breakpoint?
Any advice please? I need to get the debugger working, without having the need to put in the "debugger" keyword in javascript if possible.
My IDE is visual studio 2008 SP 1 and IE 8 as the browser.
Cheers

Do you have the solution set up to start up both projects with debugging when you start the debugger? To set multiple startup projects, right-click on the solution. Choose Set Startup Projects. In the dialog, select multiple startup projects and set the two web sites to start up with debugging when the debugger is started.
For what it's worth, I usually like to debug my javascript in Firefox with Firebug. I much prefer that to the developer tools in IE 8.

Related

Auto Build MVC app on after code behind change

In old sweet Web Forms times, when we make change on code behind, once we hit the application, it was compiling on the fly and running new changed code.
For Web Apps and MVC, when I add a new controller or change something on business logic, I have to always build app on VS 2015 manually and go back to browser and test again. But many times I keep forgetting building till I see yellow error screen.
Is there any way to kick build if there is code change and if I hit the website first time like Web Forms? I would not prefer to build on save since I am a ctrl + S freak, and keep pressing that combo on every other second.
To my knowledge Dynamic Compilation is not available in an MVC application because it won't be a "Web Site" project, it will be a "Web Application" project. Only Web Site projects can do dynamic compilation, since with MVC you're routing to actions in the controller my guess is it has to be compiled in advance - unlike ASP.NET where you're routing to a physical file.

Need to debug both asp and silverlight solutions together

I have two solutions, one is asp.net and another one silverlight solution. Both of them are hosted on my local server. What I need is to debug two solutions simultaneously, in asp solution i have page with a code like that
<iframe src="http://localhost/UI_RegInc/UI_RegInc.aspx?UserId=<%=UserId%>"
frameborder="0" height="620" scrolling="no" width="1000" marginheight="0" marginwidth="0">
</iframe>
Here i'm calling UI_RegInc silverlight application, where UI_RegInc.aspx page is calling silverlight application that i want to debug.
What I tried was to start asp application, then in another instance of VS i launch silverlight applicaton, it is UI_RegInc, and in this instance
trying to attach it to iexplorer process with asp application. But getting no positive result. Also tried to attach to webdev process.
A cumbersome explanation, but hope will understand.
Add your ASP.NET and the Silverlight project to a common solution and the Visual Studio debugger will attach to the Silverlight application automatically while debugging the website project. You cannot attach two separate instances of Visual Studio to the same Internet Explorer instance, so you have to add both to the same solution and debug from there.
You can either add the Silverlight project to your existing ASP.NET solution (right click solution, Add -> Existing Project) or create a new solution for times you want to debug both at the same time (create a new blank solution and add the existing projects, same as before).
Here is the process to configure everything step-by-step after that. You can download this source files to the test solution here:
http://www.singulink.com/ClientFiles/StackOverflow/CrossProjectTest.zip
The projects are as follows:
CrossProjectTest - Silverlight 4 project
CrossProjectTest.Web - ASP.NET project that hosts the Silverlight application inside Index.html
IFrameWebApp - ASP.NET project that has an <iframe> pointing to Index.html in the other ASP.NET project
1) In the ASP.NET project that is hosting the Silverlight application, change the settings so it doesn't open a page when debugging and specify a port so that you can always reach it at a known address (which in this case will be http://localhost:18000). You don't want it to open a page because the IFrame ASP.NET project has the actual page you want to show. We still want it to hook the debugger into the web server process though, which is where step #3 will come in.
2) Point the src attribute of your iframe inside the IFrame project at the known address of the page that hosts the silverlight application in the other ASP.NET project, like so:
<iframe width="100%" height="100%" src="http://localhost:18000/Index.html"></iframe>
3) Right click on the solution file, and select Properties. Under "startup project" you will want to select "Multiple startup projects" and set the start action for both of your ASP.NET projects to "Start".
4) Make sure Silverlight debugging is enabled inside BOTH the ASP.NET projects, especially the IFrame project for this particular scenario:
5) Set a breakpoint in your Silverlight application, press F5, and everything should launch. Because you set both ASP.NET projects to start, it will fire up both development web servers but only one internet browser, pointed to the IFrame project. I added a breakpoint in the App Startup of the Silverlight project just to demonstrate it getting hit:
6) Press F5 to continue execution and Silverlight should show up in the IFrame, as can be seen here:
7) Happily place breakpoints in any of the three projects and Visual Studio will debug all of them!
You have to check Silverlight on your Web project that host Silverlighth application.

ASP.NET MVC - Quickest way to preview changes to page in MVC app using VS web server

I'm an ASP.NET Web Forms developer who has recently switched over to an MVC web app.
I'm having difficulty working out the quickest way to preview code changes when running the MVC web app through the integrated Visual Studio web browser.
In web forms, I can make a change to the codebehind and simply refresh the page and it's all good.
In MVC, I seem to have to close the tab in the browser, return to Visual Studio and press F5, wait for it to build every single dependent project and open up a new tab in the browser to display the page. This is so much slower than how it works in Web Forms it's driving me to distraction.
Am I doing things right? Is there a way to speed this cycle up?
The view pages themselves are compiled dynamically and thus any changes to these can be viewed simply by saving the changes and refreshing the pages in the browser. Changes to code made elsewhere, however, will require a rebuilt after which you can refresh the page.
Pressing F5 will start the web server (if it isn't already started) and then attach a debugger to the process after which it will fire up the web page. The first two steps are very slow, and you should avoid them unless you specifically need to start the web server or debug the application.
So
Changes to view: ctrl+s -> refresh web page (f5)
Changes to code: ctrl+shift+b -> refresh web page (f5)
I used to find setting my project to run via IIS, rather than Cassini, made it a bit quicker. If you've made changes to the code, you'll still have to compile the solution, but at least this way you aren't waiting for Visual Studio to slowly crank itself into gear every time.
Found this article that might provide some clues too:
What are the (dis)advantages of using Cassini instead of IIS?

asp.net compilation has browser issue

I am compiling asp.net 2.0 code. I have IE 8. When I compile application, it open two browser. One browser is blank and other one show web form after a while.
why it happening?
You have 2 web projects in the solution and it's starting both of them up. To avoid this, go to properties on the one you don't want, the Web tab, then change the Start Action to Don't open a page.

ASP.net: Website or web application project

Is there any difference between website and web application project? What if you are working on a project that is sort of hybrid of site and application? which project should you chose?
I'ld go the newer Web Application project (always, regardless of the size of the project).
There is nothing to lose and everything to gain with using the Web Application Project (you cannot say this about using the "website" only).
The official list of differences are here:
Use Web Application Projects when you
Need to migrate large Visual Studio.NET 2003 applications
Need to
control names of output assemblies
Need stand-alone classes to
reference page and user control
classes
Need to build a Web
application using multiple Web
projects
Need to add pre-build and
post-build steps during compilation
Use Websites if you:
Need to generate one assembly for each page.
Prefer single-page code model to code-behind model.
Prefer dynamic compilation and working on pages without building entire site on each page view (that is, save file and then simply refresh the page in the browser).
Want to open and edit any directory as a Web project without creating a project file
#Mehrdad's link here is essential if you want to know more http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5
As for which project to choose, I would go with the Web Application Project, regardless of size. Having all of your code behind compile down into a single DLL is a major benefit for maintenance and security on the hosting end. I know there are precompile options for web site projects, but they seemed like more trouble that it was worth for me.
I know that the IIS filters are in place to prevent users from accessing your .vb or .cs files, but it still makes me a little leery.
But more important to this is the nice fact that if you make a bunch of coding changes, or maybe add some classes and change the processing logic, the only thing you have to merge up is the compiled DLL and nothing else. Similarly, if you do a few UI changes (say change the stylesheet or position of a few controls), you don't have to worry about recompiling the application, you simply bring over the update .aspx page and you're done.
Take a look:
http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5
http://forums.asp.net/p/1300026/2538628.aspx
I'm used to create websites when I want to create a new webapplication.
My current project had some problems on compiling, so I switched to a webapplication project. The step isn't very hard. Visual Studio helps you to change all necessary lines.
Refer to the links in the post:
http://www.codersbarn.com/post/2008/06/01/ASPNET-Web-Site-versus-Web-Application-Project.aspx
Anthony :-)

Resources