开发者

works correctly on localhost but fails sometimes online

I have the following problem, I make a web site when I run this website (locally) I get the correct data (for example I have a set of cities according to the city selection, I get the required data), but when I publish the website and try it online (I get incorrect data under the same conditions I tried before locally).

I don't know what the problem 开发者_如何学JAVAis; I need to trace the code online (debug the code online) to know where the problem.

Are there any suggestions on how to treat cases like this, where the code works in the correct manner locally but fails sometimes online?

Note:

- I use (https) online.

- I use static variables (not supposed to be changed) but online, the value of this variable is changing and causing this problem.


Is the "incorrect data" random garbage (as in, uninitialized variables) or is it reasonable data, just not the data you were expecting?

If you use XmlHttpRequest to load data, check for cross-domain references in your browser javascript. The scheme, domain name, and port number of the URL in the XmlHttpRequest must match the URL of the containing HTML page. Browsers don't enforce the same-domain origin security policy on pages loaded from localhost as for pages loaded from "real" URLs. This can cause differences in behavior when loading a page from localhost vs from a real URL.

Try loading your page from 127.0.0.1 instead of from localhost. If the problem repro's on 127.0.0.1 but not on localhost, it's very likely that you have some sort of cross-domain reference in your JavaScript. Browsers give special treatment to "localhost" domain, but not to 127.0.0.1 even though it maps to the same thing.


First you enable tracing for your ASPX page:

<% @Page Trace="[True|False]" %> 

Once tracing is enabled, you can identify the cause of the problem.


And finally , i detect the problem , i use some variables as static ( i thought the static members per user ) but it is shared between all users in memory so when i try my web application locally(one user) no error appeared, but when i publish it ,more than one user so if one user select specific city and another user after while select another city( the static variable value changed and i get incorrect data. when i change the static to session , the problem has been solved..

but i want to ask how to debug online and put a break point to trace the code and detect errors like that ..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜