asp.net-ajax

A potentially dangerous Request.QueryString value was detected from the client when sending html markup from jquery post call to asp.net page

余生长醉 提交于 2019-11-27 23:24:58
I m making an ajax call using jQuery to an ASP.NET page which acts as my ajax server page to save the data which i am sending to it in the query string. In the ASP.NET page when i am trying to read the querystring i am getting this error: A potentially dangerous Request.QueryString value was detected from the client... I have set the ValidateRequest="false" in my page. Dont want to set it for all the pages. So did it in page level instead of config level: var content = "<h3>Sample header</h3><p>sample para</p>" content = encodeURIComponent(content); var url = "../Lib/ajaxhandler.aspx?mode

Image.FromStream(PostedFile.InputStream) Fails. (Parameter is not valid.) (AsyncFileUpload))

蓝咒 提交于 2019-11-27 23:16:24
I'm using an AsyncFileUpload (AJAX Toolkit) to upload images. I have a Button which handle the image resizing. This have worked fine for some time, but not anymore... protected void BtnUploadImage_Click(object sender, EventArgs e) { var imageFileNameRegEx = new Regex(@"(.*?)\.(jpg|jpeg|png|gif)$", RegexOptions.IgnoreCase); if (!AsyncFileUpload1.HasFile || !imageFileNameRegEx.IsMatch(AsyncFileUpload1.FileName)) { AsyncFileUpload1.FailedValidation = true; ErrorLabel.Visible = true; return; } ErrorLabel.Visible = false; var file = AsyncFileUpload1.PostedFile.InputStream; var img = Image

Deserializing JSON objects as List<type> not working with asmx service

扶醉桌前 提交于 2019-11-27 20:36:38
I am having trouble deserializing my JSON string. I have a class of type person with public properties for sequence number of type int, first name, and last name. I want to pass an array of these objects in JSON format and have them deserialized as a list so I can loop through them on the server, but ASP.NET says something about not being supported to be deserialized as an array. I have validated the JSON I am producing, and it is valid. Is there something special about the JSON that ASP.NET needs to have before it can deserialize? The funny thing is if I serialize a list<person> object to

Pros and cons of MS Ajax vs. jQuery in an ASP.NET MVC app?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 19:49:58
Now that RC1 is out I need to decide once and for all whether to use MS Ajax libraries or just jQuery for AJAX requests. The application is a new application. Essentially the way I'll decide is whether or not i get any significant benefit from the Microsoft libraries that I wouldn't get from jQuery. I already HAVE jQuery loading and I am concerned about the extra overhead of file size more than anything. As far as I'm aware -- the only benefit really is that there are helpers like Ajax.BeginForm , but perhaps these will work with jQuery at some point anyway? I was also told today by a

jquery datepicker ms ajax updatepanel doesn't work after post back

寵の児 提交于 2019-11-27 19:30:03
So I did some reading of the related questions and had some interesting stuff but did not find my answer, at least did not understand the answer. I am very new to AJAX, javascript and sclient side scripting in general. I have been using C# asp.net for a bit and recently added some updatepanels to my side to smooth so of the user controls and bits being updated so that the page was not reloaded each time. All works brilliantly and I was very happy with it till I decided to try and use some JQuery. I have picked up the datepicker from ui.jquery.js which is cool and works great on a normal page.

Why PartialView cannot reload with Ajax in MVC

六月ゝ 毕业季﹏ 提交于 2019-11-27 19:28:22
问题 I use a popup window to create a new record and I render a view inside the window. In addition to this, I call a partialview in this view according to the selectedindex of a combobox in it. I can successfully post the form to the Controller and return it to the view when there is an error. However, after returning the form, only the view part returns and I cannot render the partialview . So, how can I also render partialview as the last status just before submitting the form? View: <script

Thread Safety in Javascript?

◇◆丶佛笑我妖孽 提交于 2019-11-27 18:44:39
I have a function called save(), this function gathers up all the inputs on the page, and performs an AJAX call to the server to save the state of the user's work. save() is currently called when a user clicks the save button, or performs some other action which requires us to have the most current state on the server (generate a document from the page for example). I am adding in the ability to auto save the user's work every so often. First I would like to prevent an AutoSave and a User generated save from running at the same time. So we have the following code (I am cutting most of the code

Server-side ASP.Net Ajax exception handling

[亡魂溺海] 提交于 2019-11-27 18:29:23
问题 I am using ASP.net's AJAX framework and I am trying to do some exception logging on the javascript-called webservice. Looking through the web, I find some people handling them client-side and sending them back to the server. I'd prefer not doing that since it relies on an other server call (if it failed the first time, sending an other request doesn't look like a good idea and that makes me change all my calls) I see some other people decorating all their methods with try... catch blocks

Ajax Pagination in PagedList.MVC using partial Page

和自甴很熟 提交于 2019-11-27 18:23:56
PagedList.Mvc is working fine if I do not use partial page but when I use partial page with ajax to load the grid then there is problem in pagination.and I ended with the support from TroyGoode https://github.com/TroyGoode/PagedList/issues/26#issuecomment-6471793 , But link provided for the support is not working. Right now, I have used like this @Html.PagedListPager((IPagedList)Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page })) , which loads the page but I need to change the pagination ajaxically. How can I achieve this? Yogendra Paudyal This issue is solved by

ASP.NET MVC “Ajax.BeginForm” executes OnSuccess even though model is not valid

倖福魔咒の 提交于 2019-11-27 13:57:39
问题 I have a "submit feedback" form which uses "Ajax.BeginForm" to render a partial containing the form elements. The OnSuccess event is triggering even if the ModelState is not valid. Is this normal? I was expecting to be able to do a few postbacks resulting in an invalid model, then when the model is valid and there are no errors then the OnSuccess event would trigger? 回答1: I handle this issue with a fairly simple javascript technique: First setup your OnSuccess like this: OnSuccess =