Ajax.NET and large arguments
On issue I never tested was the length of the request. Because browsers do not allow to use long URLs (I don't know the maximum lenght) you could get a script error on the client-side if the arguments send to the server are too long. I have fixed this in version 5.5.12.3 that will be available for download.
10 Comments
Comments have been disabled for this content.
Bertrand Le Roy said
In ASP.NET 2.0, we never use GET requests with XmlHttp, only POST. That gets rid of the problem.
Michael Schwarz said
;) That I have already done for some days, but I forgot to remove the old way with the GET.
Alan W. Cruz said
I'm having a go at making my own ajax wrapper inspired on ur implementation. However, in my httphandler I'm unable to access POST data via context.Request.Form, but context.Request.InputStream.Length has the length of the POST data i'm sending. Could you guys help my with this? thnx
Ole said
Alan, why are you working on your own library? Why do you not using the Ajax.NET??
Damien McGivern said
Alan when you use POST the data is stored in Response.Headers
Damien McGivern said
Alan - sorry I was thinking of something else(setRequestHeader) in that last post - you have to read the input stream yourself - you don't use Request.Form
ttyp said
when i use your demo to test.and i add a simple HttpModule to this project.then an error 'undefined variable DemoMethods' is occured.why?
the HttpModule code is:
added in web.config
<httpModules>
<add name="MyModuler" type="MyModuler.demo, MyModuler" />
</httpModules>
added in Global.asax:
protected void MyModuler_OnMyEvent(Object src, EventArgs e)
{
//Context.Response.Write("Hello from MyModule_OnMyEvent called in Global.asax.<br>");
}
demo.cs
using System;
using System.Web;
namespace MyModuler
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class demo:IHttpModule
{
public demo()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void Init(HttpApplication app)
{
app.BeginRequest += new EventHandler(OnBeginRequest);
}
public void Dispose(){ }
public delegate void MyEventHandler(Object s, EventArgs e);
private MyEventHandler _eventHandler = null;
public event MyEventHandler MyEvent
{
add { _eventHandler += value; }
remove { _eventHandler -= value; }
}
public void OnBeginRequest(Object s, EventArgs e)
{
HttpApplication app = s as HttpApplication;
app.Context.Response.Write("Hello from OnBeginRequest in custom module.<br>");
if(_eventHandler!=null)
_eventHandler(this, null);
}
}
}
Alan W. Cruz said
Yup, I had to read the input stream and seperate parameters manually, why is this? I'm making my own library just for fun and of course to learn something new ;). I was very interested in how reflection could expose assembly methods but since the ajax.net wrapper source wasn't available I began my own :) thnx guys.
Michael Schwarz said
@ttyp: If you write something on each request you will modify my javascript files, also. And if you write "no javascript" code there will be an error on execution time. You have to check if the url is below the "ajax" folder.
ttyp said
i just write some demo wrods.how can i modify the javascript files you point?
the project is your c# demo.what is the 'ajax' folder?
btw:can you say something about how can you translate server method into client method?