SignalR - Error during negotiation request - signalr

I have a successfully running signalr project where the work is done from an html page. I have taken the exact same html and pasted it into a .aspx page (with no master).
The signalr connection fails from the .aspx page giving error: Error during negotiation request
Has anyone any idea why this is. The code is exactly the same in the html and the .aspx page.
Have not included code here as it is working from the html page but if someone needs it please just ask.

Gave up late last night, woke up and first thing I thought of was so blindingly obvious but will post here anyway in case it helps someone else - by moving to a .aspx page, a postback occurs when the input button is clicked (obviously)!. Anyway so by just adding return false; to the javascript button onclick function resolved the issue and am now able to connect to signalr.

Related

Ajax not working on Server

I have downloaded the latest toolkit from https://www.nuget.org/packages/AjaxControlToolkit/.
Problem is it works fine on my local host but not when i upload it to the server. I don't even get an error message. Simply anything Ajax related is not working. I'm suspecting that the installation I did is the problem, since it does everything automatically for me and in my project I can't add a ScriptManager since it keeps saying that I already have one in my system, eventhough I can't see in anywhere in my code.
Do anyone have any idea what the problem might be or what I'm missing?
You have a ScriptManager on the master page, and therefore when your child page gets composited with the master page there ends up being two script managers.
The normal solution is to only have the ScriptManager on the master page.

ASP.NET 2.0 website white screen of death

I am encountering a strange issue which is only affecting several users from an over 7000 user-base. Having searched the web for several hours to no avail, I'm hoping someone here can help!
I have an ASP.NET 2.0 website and when certain users try to access the home page (Default.aspx) they receive a white screen with no content loaded. This issue is occurring both in production environment and if I run the solution against a copy of production data. So I am able to replicate the exact same issue when I pseudo the problematic users.
When debugging the application in VS2005 and set a breakpoint in the code behind in the Default.aspx, the breakpoints are fired/hit so I know the request is working. The problem seems to be once the server has finished serving the request, the response back to the client/browser is empty.
Here's another strange thing I've noticed. If I alter the HTML in Default.aspx by adding a new white line or whitespace, the page will load fine for the same set of users. I thought I had resolved the issue with this fix but unfortunately the white screen issue just manifests itself once again.
Within Default.aspx, there's some AJAX requests using jQuery .load function but this can't be the issue because this functionality exists for every user of the site. The only variable is the amount of content returned within this request can vary depending on the user. But why would it resolve itself when I put a whitespace or whiteline in the page and then manifest itself hours later?
Another thing to note is it's only Default.aspx that is encountering this issue. If I browse to another page by typing in a page in the address bar, the page is served OK.
Hope someone can point me in the right direction on how I can debug or even resolve the issue.
It sounds like your ajax is the cause but without seeing some code, it's difficult to know why.
It could be a timeout, or an error that is preventing the ajax from completing it's function.
You need to use a tool like Charles or Fiddler to debug what is happening whilst the page loads whilst logged in as these users. In a nutshell, a tool like Charles will display all the detail surrounding requests made and responses served to the browser, including any failed responses.
I think it has to do with http headers, caching or encoding. But I cannot tell more without code.
Is output caching enabled for this page?
Can you give us the raw http headers for both the request and response?
If a white screen appears, will it be fixed by pressing ctrl+f5?

'System.Web.HttpContext.Current.Session' is null

I have an ASP.NET website that has been deployed since 2008 with plenty of users. From time to time, I've made updates to the site and uploaded those changes to the server without problems.
However, today, I'm trying to run the site on my development environment and I keep getting errors any time the code tries to access session state. It appears System.Web.HttpContext.Current.Session is always null!
Any suggestions on where to look? It's been a while since I worked on it and am not 100% sure if I've worked on it with the current version of ASP.NET (4.0).
Other than that, the code's been working fine and I haven't made any changes since it was last working.
More Information
I've spent all morning on this but I apparently have a larger issue.
If I step through the code, I see that my page Load handler executes. At this point, Session is not null. After that, my specialized master page executes. After that, my general master page executes. I then step through load events for a couple of controls. This all seems very normal.
Then, if I keep executing, suddenly I'm loading a specialized master page for another page and Session is now null!
If I hit F5, it the original page shows. But somehow it is causing the other page to load and without session state. If I turn off debug mode, it appears to run normally.
Obviously, I have something strange happening. I need to determine why the other page is being loaded.
Try to put a static page, something like Test.aspx and browse to that page. If it gets loaded, try to use Session property of the page in code behind. Do you still get the error? In that case, Session doesn't load. I suggest creating an HTTP Module and hooking into a method which is responsible for loading Session info. See what's wrong.
Just a guess - did you deactivate sessionState for any reason? Anything like this:
<sessionState mode="Off"/>
My apologies. The information I provided was completely misguided and was not sufficient to resolve the issue.
The problem was actually due to some custom error handling that redirected to an error page. This was configured in web.config. This error page was using the master page that my code was mysteriously executing.
Apparently, an error was occurring within the GridView control. This is ASP.NET code and not my own, so I was unable to step through it or catch it with a regular handler.
This was hard to understand. If I was executing the Load event handler of my error page, then it would've been obvious. But it appears to have skipped over that. Thus, my confusion.
Try checking the global.asax file or any other pre-load events and make sure the Session is not set to NULL explicitly.
Maybe your erring master page is calling code from some external class where the session object is not available?

navagating while updating update-panel

I have build an asp.net web site with 3 pages.
One of the pages has an update panel. It takes the server few seconds to update this panel.
When the client asks the server to update this panel, and tries to navigate to another page in my site at the same time - a problem occurs on FF only: the client cannot submit request to navigate to another page. Its request seems to be stuck (via firebug).
I googled and found that when a ajax request is invoked, the update panel is blocked and no other request to the server can be handeled. Is that so? Does someone can shed some light about the problem and how to solve it?
Thanks in advance.
This may be to do be firefox not being able to resolve the __doPostBack call correctly? When __doPostBack is called, if the script is unsuccessful in making the ajax call it falls back to a full post back of the client. Try looking into differencing of how firefox might handle this script call, not sure of the exact solution, but hope it helps.

Javascript error : " 'Sys' is undefined "

I keep having an error when running my web application. The error does not cause a compilation error when on live server at least a javascript error and nothing else. But the real problem is when "debug" ... javascript error stops the compilation and I have to "Continue" three times before proceeding normally my debug. But this error occurs at every refresh the page. All this using Visual Studio.
After several hours of search on google, I saw that it was a problem with the ScriptManager and Ajax. The real problem is that I do not use any Ajax on this page but the ScriptManager is on the masterpage. Worse still, on any other page on the website, that may use Ajax or not, no javascript error! Only THIS page cause this error! Any suggestion?
Note that I usualy talk french so there's probably error and sorry for this!
EDIT
There's the 3 places were compilation stop.
1. Sys.WebForms.PageRequestManager._initialize('ctl00$ctl08', document.getElementById('aspnetForm'));
2. Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
3. Sys.Application.initialize();
Make sure you include the asp.net-ajax script manager control on your pages.
Update:
From the comment:
But ONE page which do not use Ajax or anything relativly to the scriptmanager cause this error.
Wrong. The scriptmanager control causes a bunch of javascript to be included (<link ..>-ed) in your rendered html page. Without that scriptmanager control, this javascript won't be available. Among the linked javascript is the Sys object that your error is complaining about. The only way you get the Sys is undefined error is if you have javascript for your page that in some way tries to use the Sys object (perhaps via a third part control?). So I promise you, you are using "Ajax or [something related]."
However, you said you included a scriptmanager on your master page, and that should have been good enough. The most common reasons for this to be missing are that your scriptmanager control is missing or that you execute javascript that needs it before the javascript engine has imported it. So check again and make sure 1) that the page in question isn't somehow "special" in that it doesn't use the master page, and 2) that you don't have javascript running before the asp.net ajax scripts are imported.
This isn't an answer to your question, more of a suggestion for the future. I think Joel did a fine job of answering the question anyway.
For your sanity, get rid of that Microsoft AJAX. It's crap & it's not real AJAX anyway 'cause you're sending back the whole page anyway. It's just asynchronous.
Those meaningless & unnecessary "Sys is undefined" errors are part of the reason I abandoned Microsoft AJAX.
Move on to jQuery & MVC. It makes development fun again.

Resources