VS2013 MVC Debug: Chrome Doesn't Reflect Updated File - asp.net-mvc

I was busily debugging an MVC4 app, written in C# under VS2013, using the Chrome debugger. Everything was working fine... until suddenly Chrome stopped reflecting updates to the view I was editing.
In other words, I'd change code in the view in VS2013 (while the server was running), flip over to Chrome, hit reload (or event Ctrl-F5)...and my changes were ignored.
I tried clearing the Chrome cache. No joy.
I tried rebooting the machine. No joy.
What the heck is going on? Feels like there's a cached version of the file someplace which didn't get deleted.

You might want to read the post below:
http://www.asp.net/visual-studio/overview/2013/using-browser-link
The Browser Link controls are located in the dropdown with the circular arrow icon. The arrow icon is the Refresh button.
I have not tried this but according to the post, the Refresh button would reload your changes.
Hope it helps.

Related

iOS Safari loads a wrong page

I've met a very strange bug when tried to open my web site http://akr-congress2016.ru/ in iOS Safari. Please see the screenshot below.
It seems like some elements are loaded from a completely other web site. The new site is a copy of the old one, but layout files (I'm using Phalcon) are changed. There is no link to the old web site at the page.
Also I've noticed doubled logo, it seems like a rendering bug.
When I refresh the page it is loaded normally.
I'm weird what might make Safari to load some fragments of the page from completely another domain.
The screenshot
Try to remove cache from browser. Or maybe it's just an issue of DNS. In that case you just need to wait untill DNS will get updated.

How can I activate the Firefox debugger?

While debugging a JavaScript program I was writing with Firebug, the Script panel stopped working and I got the following message:
I went through all menus and sub-menus I could find but didn't see a option to re-enable this feature. The console.log() command doesn't work in Firebug as well (while it does work in the built-in devtools' console).
How can I re-activate the Firebug Script panel? What may have caused this?
This may have different causes. One of them is described in issue 5646, which is related to going back and forward in the browser history.
In such cases it normally requires a browser restart to work again.
Note that Firebug up to version 1.12 is based on an old debugger API exposed by Firefox called JSD, which is unmaintained and buggy. Since version 2.0 Firebug uses a new debugger API, which fixes this problem.
Coincidentally, I just "fixed" the same problem with my Firebug.
I went through re-installs, options resets and such and nothing helped.
After some investigation it boiled down to the content of the page I was debugging.
I have a function called by jQuery when page load is finished:
<script>
$(onPageLoad);
</script>
Now, this function asks user to enter his name using prompt() function. It appeared that Firebug wouldn't activate script panel until prompt() is closed. That is not a problem when you have just one page opened since you just close the dialog and everything works. However, it is a problem when you have two same pages opened. Script panel is non-operational until you close both prompts.
I was facing this problem recently. I found that my Firebug was not getting updated because my Firefox was stuck on 29.x. Once I updated my Firefox the new Firebug got installed. It supports only Firefox 30+.
Note: I was using OSX v1.9.3.
I was having same problem, and, thanks to Roman Guralink, I figured out that the the dialogue Firefox prompts you to insert the master password was the cause. When you set a master password for all password stored, FFox usually opens a dialogue to ask it just after program started. BUT, sometimes this dialogu goes behind the main window, and you don't notice it is there.

MVC delivering content when views folder is in the wrong place, how is this possible?

So, I have an MVC4 application. I must have been having slippery fingers yesterday, because on our production server I mistakenly moved the views folder to the /Content folder. Everything stopped working and I couldn't figure out why (I have a custom error page, which wasn't getting hit and I was just getting the generic IIS error page). After manually changing web.config to see the error I realized it wasn't finding the login view, found the view folders and moved it back, everything's great.
Here's the weird part. At first, I thought it might be a database problem so I rebooted Sql Server, and everything started working. Then later when I actually found the problem, it started erroring again. Anyways, just wondering if anybody has any ideas who it was working in the first place?
Thanks
If you published you site using Visual Studio's Publish Web functionality, you may have left the "Leave extra files on destination (do not delete)" checkbox ticked. You can confirm this in the Publish Profile dialog in VS.
If this is checked, files remain on the destination in their original location even if you move or delete them.
So in your case (if the checkbox was ticked), if you accidentally moved the views folder in VS, then published to your webserver with the views in the wrong place, then the original copies would remain.
It is not clear from your question how you moved the files though. If you moved the views on the webserver itself, then this would not apply, it only applies if you made the move occur by changing their location in VS, then publishing the change..

Search result not kept when browsing back

I have a search page that uses jQuery to populate a table with search results. Search.aspx is the main page and the data is added from SearchAdd.ascx.
I decided to recreate my project and so I manually copied everything from one project to the other. Everything works and looks the same in both projects except for this thing. When I've done a search, browsed to a search result and then hit the back button in the browser, I don't get the previous search results any more.
So my question is, what do I look for?
I've checked that these are exactly the same on both projects:
viestatemode="Enabled"
jQuery scripts
global.asax
web.config
What else is there to look for? Could have anything to do with the virtual directory?
Any help is appreciated.
browser back button has nothing to do with what you have tested for. it is simply client side. it shows the thing from the browser's history, unless you have not altered the behaviour of the back button.
It had to do with the jQuery version.
In my old project I used jquery-1.4.4.min.js and in the new I used jquery-1.5.1.min.js. Switched back and the history is kept when hitting the back button.
I don't know why though?

CSS not updated during debugging ASP.NET MVC application

I am working on a test application based on ASP.NET MVC. I am new to CSS stuff so I am learning that as well.
I have created a master page called "new.master" and created a new css "new.css". I am calling the view from controller as:
return View ("About", "new");
What I am doing is that I am frequently updating the css and master page. So I run the application in debug mode frequently. After sometime I stop seeing the effect of changes in css. When I "view source" in chrome and check the css, it shows an old version.
When I change the name of both master page and css, I start to receive updated views but that works for sometime and then again I stop getting the CSS updates. Have you faced this problem? How can I fix it? (Its terribly annoying!)
Your browser is caching the css. If you force a refresh with F5 that should display any changes.
I think this may be a browser cache issue. In in IE and FF I usually do Ctrl + F5 or Ctrl + Refresh button. Also you can manually clear the cache. For IE you can use the IE Dev Toolbar and for Firefox there is Firebug with both you can clear the cache easily. Not sure about chrome, sorry.
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
I found another case in which this can happen.
We started our application with just plain links to the CSS files, then switched to using bundling. We updated the old <link href="#Url.Content("~/somePath/someStyle.css")" rel="stylesheet" type="text/css" /> to #Styles.Render("~/Styles/bundles/someStyle").
We also use a few stylesheets which are only needed for some pages, and they have their own bundle. Now, for one of them, we forgot to change the link tag to the #Styles.Render statement.
The result was that this CSS got updated now and then (so we thought everything is OK; the style wasn't missing), but we could not influence when the update happens. When I started making changes to the file, I realized that nothing I do (emptying the cache, rebuilding the project, restarting Cassini) will trigger an update. The browser always got a 304 Not modified.
So, if you have these symptoms, check your links.
Please use Ctrl+F5 to refresh your browser.
F5 may give you the same page even if the content is changed, because it may load the page from cache. But Ctrl - F5 forces a cache refresh, and will guarantee that if the content is changed, you will get the new content.
hope this will help you
Thank you
go to chroom developer panel by right click inspect -> then go to Network tap -> tick the Disable cache checkbox (note: this should always be checked) -> Refresh the page by pressing F5.
this work for me, hope this help others who have this issue! :)
It's very possible that css is being cached in your browser, so simply clearch browser cache, it should help
This happened to me when I had a master view that would load partial views depending on which partial view the user wanted to see, but the answer from this page helped, https://forums.asp.net/t/1763494.aspx?applying+CSS+layouts+to+a+partial+view
CSS must be referenced in the of the Html document. As a
consequence you cannot include them in a partial view...because in
such case the css is included in the Html body. Please plce the style
sheet in head of the page that hosts the partial view.
I would have css links in my partial views and any modifications to the css files would never happen, even if I pressed Ctrl-F5 in the browser. I also tried clearing cache contents in the developer tools. I noticed by viewing the source stylesheets that the css files linked by the partial views were not changing, so the fix for me was to move the css links from the partial view to the main view where these partial views were to be held.
I had something similar happening to me.
Then suddenly noticed the bundle was added to the page:
#Styles.Render("/bundles/classifiedDetailCss")
instead of:
#Styles.Render("~/bundles/classifiedDetailCss")
Note the missing ~ character in the first example.
(The first example only worked after building the project, otherwise it would return a cached version even in debug mode.)
This can help solve this issues in both dev and production.
use asp-append-version="true"

Resources