473,811 Members | 3,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XMLHttpRequest help

I'm trying to use XMLHttpRequest with asp.net
The tutorial that I have been following is based on PHP. All the client
script stuff was working fine, but now I'm trying to create the asp.net page
that will answer the request.

For testing, I just want to return a simple string. I thought I could do
something like this:
<code>

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] ==
"GetImgData ")
{
// this is a request from the ActiveX XmHttpRequest object trying
to get
// data about this image. I will return the big image URL, the
description
// and date/time information
Response.Write( "testing!") ;
Response.Flush( );
}
</code>

This does't work, it returns the full response with all the rendered HTML.
I'm sure I am doing this wrong, but I'm not sure why? Any ideas?

Thanks,
Steve
Nov 19 '05 #1
5 2568
Hello Steve,

Im guessing that you have this code hosted inside an ASPX file. Given that,
you can go two routes:

1. Implement an IHttpHandler [1] for your XMLHttpRequest services, or
2. Add Response.End() after Response.Flush( ). This instructs ASP.NET to stop
processing the current request.

[1] http://msdn.microsoft.com/library/de...ClassTopic.asp

--
Matt Berther
http://www.mattberther.com
I'm trying to use XMLHttpRequest with asp.net
The tutorial that I have been following is based on PHP. All the
client
script stuff was working fine, but now I'm trying to create the
asp.net page
that will answer the request.
For testing, I just want to return a simple string. I thought I could
do
something like this:
<code>
if(this.Request .QueryString.Co unt > 0 &&
this.Request.Qu eryString[0] ==
"GetImgData ")
{
// this is a request from the ActiveX XmHttpRequest object
trying
to get
// data about this image. I will return the big image URL,
the
description
// and date/time information
Response.Write( "testing!") ;
Response.Flush( );
}
</code>
This does't work, it returns the full response with all the rendered
HTML. I'm sure I am doing this wrong, but I'm not sure why? Any
ideas?

Thanks,
Steve


Nov 19 '05 #2
adding response.end didn't seem to have any effect at all, I tried it before
and after the flush() call.
I will look into the handler approach. Seems like it will be more work, but
sometimes that's a good thing.

Thanks!
"Matt Berther" <mb******@hotma il.com> wrote in message
news:22******** *************** ****@news.micro soft.com...
Hello Steve,

Im guessing that you have this code hosted inside an ASPX file. Given that, you can go two routes:

1. Implement an IHttpHandler [1] for your XMLHttpRequest services, or
2. Add Response.End() after Response.Flush( ). This instructs ASP.NET to stop processing the current request.

[1] http://msdn.microsoft.com/library/de...ClassTopic.asp
--
Matt Berther
http://www.mattberther.com
I'm trying to use XMLHttpRequest with asp.net
The tutorial that I have been following is based on PHP. All the
client
script stuff was working fine, but now I'm trying to create the
asp.net page
that will answer the request.
For testing, I just want to return a simple string. I thought I could
do
something like this:
<code>
if(this.Request .QueryString.Co unt > 0 &&
this.Request.Qu eryString[0] ==
"GetImgData ")
{
// this is a request from the ActiveX XmHttpRequest object
trying
to get
// data about this image. I will return the big image URL,
the
description
// and date/time information
Response.Write( "testing!") ;
Response.Flush( );
}
</code>
This does't work, it returns the full response with all the rendered
HTML. I'm sure I am doing this wrong, but I'm not sure why? Any
ideas?

Thanks,
Steve


Nov 19 '05 #3
try:

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] ==
"GetImgData ")
{
Response.Clear( ); // remove all buffered content
Response.Write( "testing!") ;
Response.End(); // don't write any more
}

-- bruce (sqlwork.com)

"Steve" <ss*@sss.com> wrote in message
news:eh******** ******@TK2MSFTN GP14.phx.gbl...
I'm trying to use XMLHttpRequest with asp.net
The tutorial that I have been following is based on PHP. All the client
script stuff was working fine, but now I'm trying to create the asp.net
page
that will answer the request.

For testing, I just want to return a simple string. I thought I could do
something like this:
<code>

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] ==
"GetImgData ")
{
// this is a request from the ActiveX XmHttpRequest object trying
to get
// data about this image. I will return the big image URL, the
description
// and date/time information
Response.Write( "testing!") ;
Response.Flush( );
}
</code>

This does't work, it returns the full response with all the rendered HTML.
I'm sure I am doing this wrong, but I'm not sure why? Any ideas?

Thanks,
Steve

Nov 19 '05 #4
thanks for the post, that didn't do it either. I still get the whole page
back.
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
try:

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] ==
"GetImgData ")
{
Response.Clear( ); // remove all buffered content
Response.Write( "testing!") ;
Response.End(); // don't write any more
}

-- bruce (sqlwork.com)

"Steve" <ss*@sss.com> wrote in message
news:eh******** ******@TK2MSFTN GP14.phx.gbl...
I'm trying to use XMLHttpRequest with asp.net
The tutorial that I have been following is based on PHP. All the client
script stuff was working fine, but now I'm trying to create the asp.net
page
that will answer the request.

For testing, I just want to return a simple string. I thought I could do something like this:
<code>

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] == "GetImgData ")
{
// this is a request from the ActiveX XmHttpRequest object trying to get
// data about this image. I will return the big image URL, the
description
// and date/time information
Response.Write( "testing!") ;
Response.Flush( );
}
</code>

This does't work, it returns the full response with all the rendered HTML. I'm sure I am doing this wrong, but I'm not sure why? Any ideas?

Thanks,
Steve


Nov 19 '05 #5
ah, this does work. I wasn't building the correct project. Thanks for the
help, I'm off and tunning now! ;)
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
try:

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] ==
"GetImgData ")
{
Response.Clear( ); // remove all buffered content
Response.Write( "testing!") ;
Response.End(); // don't write any more
}

-- bruce (sqlwork.com)

"Steve" <ss*@sss.com> wrote in message
news:eh******** ******@TK2MSFTN GP14.phx.gbl...
I'm trying to use XMLHttpRequest with asp.net
The tutorial that I have been following is based on PHP. All the client
script stuff was working fine, but now I'm trying to create the asp.net
page
that will answer the request.

For testing, I just want to return a simple string. I thought I could do something like this:
<code>

if(this.Request .QueryString.Co unt > 0 && this.Request.Qu eryString[0] == "GetImgData ")
{
// this is a request from the ActiveX XmHttpRequest object trying to get
// data about this image. I will return the big image URL, the
description
// and date/time information
Response.Write( "testing!") ;
Response.Flush( );
}
</code>

This does't work, it returns the full response with all the rendered HTML. I'm sure I am doing this wrong, but I'm not sure why? Any ideas?

Thanks,
Steve


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
5059
by: Gaz | last post by:
In Internet Explorer 6 I'm having a problem with the httprequest object. I use it to call a webservice and display the result in the readystate event handler. This works the first time I call it but subsequently the readystate event handler function is never called, or the event itself is never fired. The same code works fine in Firefox. Changed it around a lot to no effect Can anyone help? I'm not supposed to create a new...
10
14100
by: Matt Kruse | last post by:
I'm aware of the circular reference memory leak problem with IE/closures. I'm not sure exactly how to resolve it in this situation. Also, Firefox appears to grow its memory size with the same code. So I'm wondering if I'm missing something? My test code is as follows: function myObj() { var req = new Object(); req.temp = 0;
1
2486
by: Elizabeth Harmon | last post by:
Good Evening, I am new to the XMLHTTPRequest Object and it's use but i am doing pretty good with it since it's realtively simple? I am having one problem in using a Get method. I am requesting an aspx file that contains some controls, intersoft Web Combo to be exact. This control is a drop downlist control that renders it's contents in an XML file structure. When i do a XMLHTTPRequest("GET",URL,true), the response text is sent back...
1
4036
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest technology is implemented on more sites now than ever. Compatibility is no longer an issue (IE, Mozilla and Opera all support it), and the benefits to using it are amazing. There are too many PHP programmers avoiding any
1
5306
by: Tarik Monem | last post by:
OK, I'm pretty sure this cannot work because I'm trying to use JavaScript (client-side) to write to an xml file (which is server-side) using XMLHttpRequest. Can I use PHP do what I'm trying to do? Here's my code: The function mySaveFunction() is called by clicking the "Update" button, after the user changes the data which is populated in the form fields, which was retrieved via XMLHttpRequest from an XML external file. I know that...
1
1410
by: shotokan99 | last post by:
hi, i wanted to check if the url is existing using xmlhttprequest. my browser is firefox. the code goes like this: window.onload=ini var xr= new XMLHttpRequest(); function ini(){ xr.open("HEAD",
2
2460
by: Michael Nemtsev [MVP] | last post by:
Hello, In the current application we have several httpmodules to process pages, and we have several pages with calls directly through the XMLHttpRequest. Now the requiremens is to detect the calls through the XMLHttpRequest and apply addional actions in httpmodule for these types of call. Because they dont use ASP.NET AJAX for this I cant use ScriptManager.IsInAsyncPostBack. Everything what comes into my my how to catch these calls is...
0
9731
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
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10405
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4342
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
2
3871
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
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.