Page Inspector: URL must map to a project in the current solution - asp.net

I'm using the standard internet application template with ASP.NET MVC 4. When I try to view Login.cshtml via Page Inspector, I get this error:
Page Inspector: URL must map to a project in the current solution
I don't see why. I don't see a URL that seems to be mapped somewhere else. Why am I getting this error?
This happens even when creating a new project, without modifying any code. Steps to reproduce:
File -> New -> Project
ASP.NET MVC 4 Web Application
Choose Internet Application
Open Views/Account/Login.cshtml
Open Page Inspector (View -> Other Windows -> Page Inspector)
Click the Problem button at the top of Page Inspector
You should see the error shown above

I found the issue. When following the steps to reproduce, in the original question, for some reason the URL in Page Inspector is this:
file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2011.0/Common7/IDE/Extensions/Microsoft/Web%20Tools/Eureka/en-US/Startup.html
I'm not sure why that happens, but Page Inspector is definitely not showing the Login form.
To get the Login form to show in Page Inspector:
Right-click anywhere in Login.cshtml, and choose View in Page
Inspector. Voila.

For me the solution turned out to be changing the Project properties -> Web -> Override application root URL to -> Unchecked.

Related

How to open specific web page in ASP.net that I'm working on or find pages that referring it in Visual Studio 2017

I've edited an ascx.cs page which I thought was relevant. When I ran the service to debug that code it wasn't the right place - The breakpoint didn't stop the service.
I know how to find the right page to edit but now I want to see what did I edit.
How can I open the page or find which pages are referring to it so I could check it also?
Have you "set as startup" that project already ? then try setting that page aspx.cs as "startup page".
After setting above both , your project will start that same projects same page that you have set up as startup.
Alternatively you can type link to that manually in address bar to get there.
While trying to set it as startup page I've found out it ascx and not aspx file. So if You want I wanted to see the edits I would need to load that page as asp controller.

IIS not directing to correct web page as visual studio.

When I created my webpage on IIS Windows Server 2012 and click on the links to switch between pages the first link works perfect as expected. When you click on another link that resides in another folder I receive a 404 Error.The Alias is causing my web page to fail. If I add the Alias then it works perfect. But it has to be done manually within the URL.
Heres an example of how the link is displayed. This works perfect as expected.
http://localhost/MyAlias/Folder/webpage.aspx.
When you click on a different link that resides in a different folder in VisualStudio it drops the Alias and causes a 404 Error. http://localhost/Folder2/webpage2.aspx. Why is the Alias being removed if I applied it to my website? Thanks in advance.
It is just related to how you link your second page. You have to link it with '../'
Here an example:
../Folder2/This is the link for page 2

.ASPX pages markups are opening in web browser

When I double click on .aspx pages in my web application project in VS2010, instead of showing the mark up in the ide the .aspx pages are opening in the web browser as shown below. The same is happening when I run my application it opens all the .aspx pages in the web browser along the application url i.e., http://localhost123456/default.aspx. I have to close all the other pages except the http://localhost123456/default.aspx to run/ test my application. Not sure what would cause this to happen. I am not able to find any solutions so far, any help is appreciated. I used the option View Markup (Rightclick on aspx page -> view Markup) to see the markup for now.
Update
As per Mike's answer I checked the options under Open with... and I do have a Internet Explorer (Default) set as shown in the following image. Not sure how did it got there.
Deleting the Internet Explorer (Default) option might be cumbersome if I have lot of .aspx pages , if there is a way to remove this option at once for all .aspx pages rather than right clicking on each and every .aspx and remove it that would be great.
As per #JB King suggestion I did checked the file properties and all the .aspx files are set with Opens with: Microsoft Visual Studio option as shown it the image below.
Right-click any .aspx file in the project, select Open With...
In the screen that pops up, select Web Form Editor, then click the Set as Default button.
Not sure how you got Internet Explorer as an option here, but if it is there, you can just delete it. It's not applicable for loading the aspx from disk. Rather, to see the rendered page in IE, you'd do View in Browser or Browse With... (in which you can set your default browser, as well).
Your address bar shows you're loading files directly from disk. This won't work. ASP.NET is not lilke static HTML. ASP.NET applications must be run from within a webserver. Install IIS and ensure ASP.NET is installed and configured, or use the Debugging Webserver (IIS Express) in Visual Studio.
If you look at the properties of the file, there should be a line of Opens with: that is where you want to have Visual Studio rather than Internet Explorer as the issue is with which programs are mapped to what file extension. Microsoft instructions if you want those as specific steps to do.

Page Inspector doesn't handle New Windows from Javascript

I have an ASP.NET application I've inherited and am trying to debug. I'm using Page Inspector in VS 2012 Express to work on a particular page that has lots of JS in it. Unfortunately, that page is opened as a popup whose URL is dynamically generated by JS. Page Inspector does not seem to handle this well.
If it just popped out into the new window, that would be OK because I could then get the URL and paste it back into the main PI window. However, it seems to lose the session reference when it pops up, because it logs me out of the application, and when I log back in I lose the location I was at.
I've tried changing the function that does the URL generation / window opening to a window.location.href, but that doesn't seem to work either; it just stays on the same page.
The references to the URL generation functions are done in such a way that it would be a lot of work to switch it from calling a JS function to just a straight link on the page, especially since I would have to switch it back for production.
Any ideas on how I can configure Page Inspector to handle popup windows better?
Thanks.

How to reset ASP.NET Startup page?

I've accidentaly clicked "Set as Startup page" on Index.aspx of ASP.NET MVC application.
Now every time I click Debug, it starts here: http://localhost:5577/Views/Home/Index.aspx
Which obviously gives me an error.
Can i revert the startup page back to the original http://localhost:5577?
Set your start URL to be blank in the project properties.
project -> property pages -> Start Options -> Use Current page
You can set the start url in the web tab of project properties
Info from msdn here

Resources