473,802 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XMLHttpRequest problem with Firefox and Netscape

1 New Member
Hi Guys,

I have a security concern with Mozilla and Netscape browsers(In IE it gives secuirity pop window) in Remote server(Client's server).When I am trying to call an Asp.NET web service from javascript using the XmlHttpRequest object

XmlHttpRequest .Open("POST", ServicesPath, false);

Problem is only in Cleint's server ,Where in web Service path given in Webconfig file is server name(not the Ip Address, We noticed that Client is using same IP number with diffrent Port number to access the diffrent application. I.e The server IP number and a port also used to access this application). I think it works fine, if we mention webservice path as IP Number with the correct PORT number. which combination is used to access the application. But we cannot modify the Host file in Client machine.

It works beautifully! in local server , where we are modifying the local host file by regestering the IP number with name, and using name in webconfig file to give service path.

CODE SNIPPET :

function createXMLHttp(s xml)
{
if (typeof XMLHttpRequest != "undefined" ) {
return new XMLHttpRequest( );
}
else if (window.ActiveX Object) {
var aVersions = [ "MSXML2.XMLHttp .5.0",
"MSXML2.XMLHttp .4.0","MSXML2.X MLHttp.3.0",
"MSXML2.XMLHttp ","Microsoft.XM LHttp"];

for (var i = 0; i < aVersions.lengt h; i++) {
try {
var oXmlHttp = new ActiveXObject(a Versions[i]);
return oXmlHttp;
}
catch (oError) {
//Do nothing
}
}
}
throw new Error("XMLHttp object could be created.");
}


function CallWS(methodXm l, methodName)
{
var xddoc, xhhttp, sxml
//alert(gc_lmsSer vicesPath);
// Create SOAP request
sxml = "<SOAP-ENV:Envelope xmlns:SOAP-ENV = 'http://schemas.xmlsoap .org/soap/envelope/'>";
sxml = sxml + "<SOAP-ENV:Body>";
sxml = sxml + methodXml;
sxml = sxml + "</SOAP-ENV:Body>";
sxml = sxml + "</SOAP-ENV:Envelope>";

xddoc = createxddoc(sxm l);
// Creating HTTP request
xhhttp = new createXMLHttp(s xml);
alert(gc_lmsSer vicesPath);

//BELOW LINE IS NOT EXECUTING WHEN SERVICE PATH GIVEN IN WEB CONGIF IS SERVER NAME(for ex : http://ClentServer/App_Name/Service.asmx ")
xhhttp.open("PO ST", gc_lmsServicesP ath, false);

xhhttp.setReque stHeader("SOAPA ction", "http://tempuri.org/" + methodName);
xhhttp.setReque stHeader("Messa geType", "CALL");
xhhttp.setReque stHeader("Conte nt-Type", "text/xml");
try
{
// Sending request to the web service by HTTP
xhhttp.send(xdd oc);
xhhttp.close;
}
catch(e)
{
throw(e);
}
if(gc_ThirdPlms ServicesPath!=" ")
SecondCall(sxml , methodName);

// Getting response from Web Service
xddoc = result(xhhttp);
return xddoc;

}
In webconfig file Service path given as follows

<add key="Service" value="http://ServerName/Service.asmx"/>


Any ideas? Thanks.
Jan 8 '07 #1
1 7593
b1randon
171 Recognized Expert New Member
Hi Guys,

I have a security concern with Mozilla and Netscape browsers(In IE it gives secuirity pop window) in Remote server(Client's server).When I am trying to call an Asp.NET web service from javascript using the XmlHttpRequest object

XmlHttpRequest .Open("POST", ServicesPath, false);

Problem is only in Cleint's server ,Where in web Service path given in Webconfig file is server name(not the Ip Address, We noticed that Client is using same IP number with diffrent Port number to access the diffrent application. I.e The server IP number and a port also used to access this application). I think it works fine, if we mention webservice path as IP Number with the correct PORT number. which combination is used to access the application. But we cannot modify the Host file in Client machine.

It works beautifully! in local server , where we are modifying the local host file by regestering the IP number with name, and using name in webconfig file to give service path.

CODE SNIPPET :

function createXMLHttp(s xml)
{
if (typeof XMLHttpRequest != "undefined" ) {
return new XMLHttpRequest( );
}
else if (window.ActiveX Object) {
var aVersions = [ "MSXML2.XMLHttp .5.0",
"MSXML2.XMLHttp .4.0","MSXML2.X MLHttp.3.0",
"MSXML2.XMLHttp ","Microsoft.XM LHttp"];

for (var i = 0; i < aVersions.lengt h; i++) {
try {
var oXmlHttp = new ActiveXObject(a Versions[i]);
return oXmlHttp;
}
catch (oError) {
//Do nothing
}
}
}
throw new Error("XMLHttp object could be created.");
}


function CallWS(methodXm l, methodName)
{
var xddoc, xhhttp, sxml
//alert(gc_lmsSer vicesPath);
// Create SOAP request
sxml = "<SOAP-ENV:Envelope xmlns:SOAP-ENV = 'http://schemas.xmlsoap .org/soap/envelope/'>";
sxml = sxml + "<SOAP-ENV:Body>";
sxml = sxml + methodXml;
sxml = sxml + "</SOAP-ENV:Body>";
sxml = sxml + "</SOAP-ENV:Envelope>";

xddoc = createxddoc(sxm l);
// Creating HTTP request
xhhttp = new createXMLHttp(s xml);
alert(gc_lmsSer vicesPath);

//BELOW LINE IS NOT EXECUTING WHEN SERVICE PATH GIVEN IN WEB CONGIF IS SERVER NAME(for ex : http://ClentServer/App_Name/Service.asmx ")
xhhttp.open("PO ST", gc_lmsServicesP ath, false);

xhhttp.setReque stHeader("SOAPA ction", "http://tempuri.org/" + methodName);
xhhttp.setReque stHeader("Messa geType", "CALL");
xhhttp.setReque stHeader("Conte nt-Type", "text/xml");
try
{
// Sending request to the web service by HTTP
xhhttp.send(xdd oc);
xhhttp.close;
}
catch(e)
{
throw(e);
}
if(gc_ThirdPlms ServicesPath!=" ")
SecondCall(sxml , methodName);

// Getting response from Web Service
xddoc = result(xhhttp);
return xddoc;

}
In webconfig file Service path given as follows

<add key="Service" value="http://ServerName/Service.asmx"/>


Any ideas? Thanks.
If it works on local only then your problem is probably that for security reasons most browsers will only let you call XMLRequests to the same domain as the page came from (unless the page is locally hosted which explains why it works locally). The only way around this is either to a) be synchronous and call a page so that your server can access the web service or b) stay asynchronous but use an ajax call to your server which will call your WS, then return it's results back to the browser. It's a hairy mess, I know, but it is one of the only ways to keep web pages from making calls all over the web without the client realizing it.
Jan 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
18246
by: Chris Smith | last post by:
This is a bit of a weird problem. Unfortunately, I can't reproduce it in a simple example, so I can only poke it out there and see if anyone has seen something similar. I have a script that uses XMLHttpRequest to communicate to a server. All functionality follows the following form: 1. Use XMLHttpRequest to make a request to the server. 2. Wait for the response (using async requests and a handler) 3. If the response indicates an...
1
5687
by: Henri Sivonen | last post by:
I got the following error: Error: " nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" .... with Firefox when using XMLHttpRequest. What's happenening? Is the object being garbage collected before the network operation finishes? My usage pattern is:
4
2125
by: one man army | last post by:
Hi All- after reading a bit more, and writing a few examples, I have begun a project which really uses the Dynamic data loading. BUT when I tried the code out, I get 'permission denied' in Mozilla, Firefox 1.04 and the Safari I have on this machine. Looking in the newsgroups, I see another post (at exactly this time of year) which say matter of factly that I have to sign my script. SO I look into the refs.
13
11509
by: TLaufenberg | last post by:
I'm new to Javascript programming and I've run into a bit of a snag with making an XMLHttpRequest in the Safari browser. Actually, the request doesn't work in Firefox either but only when I use a Mac computer. IE and FireFox on a Windows based system works just fine. The problem I am having is that the XMLHttpRequest doesn't open the site that I've programmed into it. When I check the readyState it only returns 0 and never goes through the...
5
2411
by: Peter Michaux | last post by:
Hi, The FAQ correctly says the following: "Mozilla (NN6.2+, Firefox, Ice Weasle etc), Opera 7.6+, Safari1.2+, the Windows version of IE versions 5+, and some other browsers provide the XML HTTP Request object." In my haze of testing yesterday it seems that NN6.1 provides an non-functional XMLHttpRequest object and NN6.2 XMLHttpRequest object
1
25111
by: Charlie | last post by:
I am trying to make an XMLHttpRequest which violates the default "same- origin"policy in Firefox. I checked the archives and found a method that should work but it does not. Below is the test code I isolated. I set signed.applets.codebase_principal_support true and seemed to get the UniversalBrowserRead permission but then the open still failed with the same old "Permission denied to call method XMLHttpRequest.open" error. Can someone tell...
7
1781
RMWChaos
by: RMWChaos | last post by:
Bizarro, that's all I can say. Aren't FF2.0.0.8 and NN9 both Mozilla 2 based browsers? So why would the exact same code work in one and not the other? To add insult to injury, it works just fine in IE7 too. In particular, I'm grabbing a ".txt" file, which you'll see in my code uses innerHTML to display, whereas ".xml" and ".js" files do not. Perhaps not a good way to do it...does NN9 have an issue with innerHTML? So here's my code for all...
1
1776
by: Iain Adams | last post by:
My code is as follows. http_request = false; if (window.XMLHttpRequest) { alert("firefox"); http_request = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { alert("ie");
8
5266
by: sbettadpur | last post by:
hello I am using xmlHttpRequest method in my application, this method is giving problem in the following browsers 1) Internet Explorer 7 2) Mozila Firefox(2.0.0.16) I got solution for Mozilla issue let me explain what i did
0
9698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10527
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10300
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10057
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9106
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4267
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2963
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.