How can I debug "/mysite/null" resource request? - asp.net

I've been trying to work out why our pages load slowly, and one thing I've noticed in Fiddler is that each page load for /mysite/mypage.aspx brings with it a request for GET /mysite/null HTTP/1.1, resulting in a 404 error.
I'm guessing this 404 error on every page load is slowing the site down even further, are there any ways of debugging what might be causing this? We use lots of Ajax/Javascript.
Similar question: What is the source of /path/(null) requests?, ours is slightly different because it reliably happens on every page load

Get FireFox and download FireBug as you can use this to debug XHR.
Without seeing your code this is the best advice I can give you as tracking down these bugs are usually tedious and require some intimate knowledge of the working domain. FireBug is your best bet for debugging these sorts of issues within a page.
UPDATE:
Debugging the XmlHttpRequest object in IE can be done using Julien Couvreur's bookmarklet.

If you're using IE8, you can simply use the developer toolbar (hit F12) to step through your code.
The most likely explanation is that you have a malformed URL constructed by JavaScript somewhere in your page.

Related

Huge loading time on some pages

Here is my page URL: www.1800-gifts.com/USA/Cake-Delivery and other pages like that all are loading very slow even i have caching , compression enabled, i have tried to call go daddy which is my hosting provider but they do not respond positive.
Developer is telling me that it is a server issue, but i don't find any issues in server it is fine.
This website is developed in asp.net 4.0, database is mssql 2012 r2.
server is VPS, with 2 gb of ram, I have 2 GB data in database, and some table contains more than 100k records.
Please look at my site and give me suggestions, i have checked in google page speed and other tools they are all saying different views.
I am not sure if this is the cause but if you enable developer mode (F12) and run the site in chrome you will see that the cake-delivery page is the one that is causing the loading time (44s). You will also notice that there are JQuery errors on the page.
This could possibly be part of the problem.
EDIT:
After looking at the linked page I think Erik is right, JQuery is not the issue.
The person that is developing the site needs to revisit the way the page works completely. There is a massive amount of operations happening in the page load of the page. The operations that are used are also hack and slash ways of doing things that there is already built in methods for. This is simply a page taking forever to load due to bad coding.
I would suggest the developer returns to the drawing board.
There are a lot of great tools that look at your page and tell you what might be wrong with it. Analyzing your page with GTmetrix for example gives you this. There are also important tips you can work on right away, for example:
gzip compression
Minifying css, html and js
Concatenating scripts
and a lot more. I also recently wrote an article showing important optimization for web performance
Looking at the waterfall chart of your page (also available on GTmetrix) shows that the biggest problem is indeed your server. It takes 16 seconds to receive an answer for the first request (time-to-first-byte). There is clearly something wrong!
There are a lot of things that could be wrong on your server. You should test your database queries (are they slow? How many are performed for a page load?).

How can I properly refresh a Durandal SPA web app when new views are added?

I'm just starting to play with Durandal, using the starter kit. I've added a very simple new view/viewmodel combination (essentially a copy/paste of an existing one from the sample) and mapNav()'d the route.
The problem is happening when I try to refresh my browser...the new view simply does not appear. It's not in the nav bar, nor can I navigate directly to the view by typing in the address bar. I know the code is (or should be?!) correct because if I go to the page in a different browser, everything appears as it should.
Is there some browser caching that Durandal is doing somehow? Sometimes F5 or Ctrl+F5 works to refresh, sometimes it doesn't. I also can't deep-link to a specific 'page'. Ie:
http://localhost:52625/#/newpage just gives me a blank
What am I missing?
The option that I use in Chrome is to open developer tools and right-click on the refresh button. There is an option for 'Empty Cache and Hard Reload' which always fixes this issue for me. I don't know the equivalent in IE but try this and see if it fixes your issue.
Most browsers will cache modules returned via RequireJS, which is how Durandal obtains its modules and view models.
CTRL+F5 doesn't help because that just refreshes the initial page - all the modules are still requested using javascript (RequireJS), so they are usually pulled from cache first.
I've found it's best to disable caching in your browser's developer tools. Doing so will ensure that all network requests are loaded directly from the source and not from cache.
See this question for additional information: Debugging when using require.js cache
Another solution is configure RequireJS to set its urlArgs property: https://stackoverflow.com/a/8479953/91189
This solution works ok, but makes it harder to debug, at least in Chrome, because breakpoints are lost every time the module is loaded, since it's technically a different file being requested each time.

Website not loading CSS after refresh in Chrome

So there is this site-> http://www.raudsilla.ee
This problem occurs only in Chrome- whenever you press refresh the page loses its CSS. Weird thing is that if you look the code of both- after and before refresh, they look exactly the same. And again, only happens in chrome.
I have tried quite may things, so far no luck...
I wouldn't like to rule out anything at the moment, so any help appreciated.
The browser is outputting javascript errors, if you check the code, you're calling jQuery's document ready before the script is loaded, as it says, "$ is not defined".
After fixing the existing javascript error, it should load correctly.
I am seeing the same behavior on one of our own sites and started looking for a cause. The only conclusion I could come up with for now is that it is caused by the Mime Type of your stylesheet. This conclusion is supported by the behavior on our side.
Update:
There are three ways in which Chrome seems to load the CSS file:
As a fresh request, no cached version available, our server returns HTTP 200 OK, with content-type text/css. This works fine.
From the cache, without consulting the server. Chrome has cached content-type text/css. This works fine.
As a request with a cached version available. Our server returns HTTP 304 Not Modified, with content-type text/plain. This does not work.
After some crazy tests, I found the solution by adding "?" to the url css file.
Example: href="../_css/setup_system.css?" type="text/css"
site.css was not loading in Chrome. I added the ? in the CSS url and my styles started appearing.
Shift + Refresh solves the problem so it must be a cache problem.
PS . The site takes quite a long time to load, considered optimising?
desable addblock and refresh, if the website loaded correctly check the plugin
Open the console(ctrl + shift + c) and then network panel and check the disable cache button.

How to determine what in the new FB App iframe browser is breaking https in my App

https://www.facebook.com/apps/application.php?id=212108875466071
As far as I can tell, we are doing everything right, and FB's new new mini-feed App browser seems to be injecting ONE or TWO insecure resources from time to time.... NOT all the time.
How can I be positive it's FB's fault, so I can file a bug? We are only showing broken https with the new iframe.... and most of what is being is supplied by that setup IS secure, but they have stupid little things like an insecure 'credits' ikon, which breaks the whole damn thing.
If it's our fault, I need to fix it. If it's FB's, I need to stop wasting so much time debugging their platform for them.
Look at chrome's javascript console, it show warnings when an insecure resource is loaded on a secure page.
See the warning before the syntax error.
See also http://googleonlinesecurity.blogspot.com/2011/06/trying-to-end-mixed-scripting.html (where this image come from).

IE Security Warning with widgets

I'm creating an ASP.NET application which uses Facebook Connect and fbml tags. It also uses the LinkedIn widget. When I run this app in any browser, there are no warnings and everything works. However, in IE, a message like this comes up:
Security Warning:
The current webpage is trying to open a site in your Trusted sites list. Do you want to allow this?
Current site:http://www.facebook.com
Trusted site:http://localhost
(same for LinkedIn.com). I know how to fix this from a client perspective and to stop the security warning showing up. However, is it possible to ensure this message doesn't come up as it could be off putting for users who don't know how to suppress this warning? I haven't tried uploading it to my webhost, so not sure if this message will appear for everyone in production. However, I always get it on my local machine.
(None of my pages use SSL, so I don't think that's the issue. I tried using FB's HTTPS urls but that didn't make a difference).
Thanks
I have come across the IE message many times. Whilst this might not be the case here I always check in Firebug to see if any requests are going to Https (using Net tab). If may be the case that something you are referencing is itself making a call to something else.
Often you get that message if you are serving an https page and then going to fetch an image over http.
Might not help but is the first thing I do in this situation.

Resources