Getting File From .ashx With A JQuery Post?

Jan 11, 2012

This question is a following from another question I asked - Passing client data to server to create Excel or CSV File. I have a client page which builds a JSON object to send to the server, and I have server code which can parse that JSON object into an SQL command and end up with a dataset of required data.

I had originally been passing the JSON object to an .asmx web service which would return a JSON object containing my data. Now I want to go in a different direction and have the data returned as a .csv file.

I understand I can try to put my JSON object into a query string and call my .ashx page, but the JSON object could get large, so I'm trying to use the Request.Form of a POST.

My question, and lack of understanding, is in how to use jQuery to post to the .ashx page and have it return the .csv file to the client. If I navigate to the .ashx page directly (and modify the page to hard code the passed data), I get the .csv file returned to me no problem (i.e I get the prompt to open/save the file). If I make a POST to the .ashx file from jQuery and send my JSON object through, I get a response which contains the data in a string, rather than getting a .csv.

So, is there something I am missing, or am I just trying to achieve something that I can't or shouldn't be doing? I'd thought about passing my JSON object to a .asmx web service which would store the JSON object into a database and return an ID, and then use window.location to browse to the .ashx with the ID as a query string parameter to then generate the .csv file, but I thought there might be a way to avoid that middle step and do it with the POST.

View 1 Replies


ADVERTISEMENT

How To Jquery Post In Asmx

Jan 10, 2012

Im trying to get a response from a function in a webservice but i dont think i am creating the service correctly.[code]

View 1 Replies

Asp.net Mvc - Post Code Being Triggered On JQuery Load?

Jan 13, 2010

I have the following functions in my ProceduresControlller:

Function Add(ByVal bpid As Integer) As ActionResult
Return View(GetAvailableProcedures(bpid))
End Function[code].....

I'm loading the Add dialog via jQuery like so:

$("#dialog").load(
"/Procedures/Add",
{ bpid: 123 }[code]....

This is failing because it's calling the Post method (where "covered" can't be empty) instead of the Get. I tried decorating the Get with <AcceptVerbs(HttpVerbs.Get)>, but it doesn't change the outcome.how do I get it to use the Get? I realize I could change the names to not be ambiguous, but I want to know why it won't pick the Get if I'm only passing "bpid".

View 1 Replies

Jquery - Ajax Post Method Not Working?

Dec 20, 2010

I am using jquery so using ajax to post data, but for some reason when i click on submit, the page doesnt go from aspx to aspx.vb on the back side.here's my code -

$(document).ready(function() {
$("#btnsave").click(function() {
var firstname = $("#" + '<%=firstname.ClientID%>').val();
$.ajax({

[code]....

new_class is my webmethod in the vb.net side. Now if i put an alert in the btnsave onclick function, i see the firstname value in the alert. But the page does not call the new_class function after that.

View 1 Replies

Asp.net Mvc - Sending Multiline Text Over POST Method With JQuery?

Nov 10, 2011

I have this function in JQuery:

[code]...
And it is supposed to read multiple lines from LimFile and send it to a string in VB.NET.Problem is that when I debug it, I see the string is there in full length. And when I split it with vbNewLine, it shows that theres only 1 line, aka nothing is split, like the newlines have been lost.

View 2 Replies

Jquery - Post Table Rows, Added Via Javascript To The Server In ASP.NET?

Oct 3, 2011

Access <asp:table> table rows added by javascript in asp.net webform . Apologies for the duplicate question but I'd really like an explanation why this is the case. It is probably due to my lack of understanding on how browsers process HTML tables on submission to the server.If I have a <HTML> table or an <asp:table> control on an aspx page and I add rows to it client-side using JQuery / Javascript, why can I not include these added rows in a post-back to the server?

I've been trying to get this to work and it looks like I can't do it based on the answer to the previous question. But can someone explain why this is the case? The table itself can be returned in the post-back but the only rows present are the rows that were part of the table when it was sent to the browser originally - it does not include the rows added by the browser.there was a way to include these new rows in the post-back, the same as any client-side user input?

View 4 Replies

JQuery Ajax With ASP.NET MVC Action: Passing Arguments From JavaScript In POST

Mar 4, 2011

I have an ASP.NET MVC controller action with the following VB.NET signature:

[Code]...

If I'm trying to send an Ajax POST in jQuery to the ClosestCities action, what should my request look like? When I use the following code to POST to this action, in the debugger window of VS, position.longitiude and position.latitude are equal to 0.0 (0D):

[Code]...

View 2 Replies

.ASHX File Not Being Called?

Feb 20, 2012

I am having trouble getting my .ASPX page to call my .ASHX file. Does anyone know what I might be leaving out? I have posted my entire .ASHX file below along with a little .aspx.

Imports System.Web
Imports System.Web.Services
Imports System.Data.SqlClient

[Code]....

View 1 Replies

Asp.net - Find What Process Called ProcessRequest In An .ashx Web Handler File?

Jan 31, 2012

I have a context.Request.QueryString item that is returning the wrong value in the ProcessRequest method of a .ashx handler.

The code is like so:

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim strOrderItems As String = Convert.ToString(context.Request.QueryString("OrderItems"))
End Sub

One of the values returned by "OrderItems" is wrong. How can I find out what process has called this method to fix the incorrect data?

View 1 Replies

How To Post A File Via HTTP Post

Jun 11, 2009

Having a problem with sending a file via HTTP post in vb.net. I am trying to mimic the following HTML so the vb.net does the same thing.[code]

View 4 Replies

Asp.net Mvc - Asynchronously Streaming A File System Text File Using JQuery (MVC)

Oct 28, 2011

A text file exists on my server machine which is constantly being updated (about once about 5 seconds). On my web page, I'd like a div to display this file live using jQuery inside MVC.

I have the jQuery timer working already, but the file isn't displaying. My plan was to get the jQuery to load a Controller Action every 5 seconds and have this action return a FilePathResult.

The script:

$(function () {
var streamer = $("div.wrapper div.streamer");
//===

[Code]....

LiveStreamPath contains the path to the text file. I was thinking of creating a StreamReader in the Action instead. What sorts of implementations can I use to get this file to stream?

View 2 Replies

Asp.net - .net Ashx Web Handler How To Return Lists?

Mar 2, 2012

I have a vb.net web handler which builds two strings The strings basically looks like this:

["filename", "filepath"],["filename", filepath"],...,["filename", filepath"]

I need to return it in a way that the strings are sent with the name of the list, followed by the list

["listname": {["filename", "filepath"],["filename", filepath"],...,["filename", filepath"]}

I know that the web handler will automatically json encode the data, and that the way I have built my list should be reworked (the way we previously used this it was exactly what we needed).What might be a better way for me to house my data and return it to the browser in a way that is understood correctly?

View 1 Replies

C# - Which Better To Use For Handling Requests Aspx Or Ashx?

Mar 14, 2011

i am creating a httpRequest handler to download files my question is which better to use aspx or ashx ?

View 3 Replies

Call An ASHX From Inside An ASPX.VB Function?

Feb 24, 2009

I need to get a value from an API I made with ASHX and normally it is called from javascript but I need to call it right in ASP.NET I figured this shouldn't be a problem but I'm not sure the syntax.

View 2 Replies

Asp.net - Return Re-sized Image From Database Through .ashx

Aug 8, 2011

I'm looking to return a thumbnail image from a full size image stored as varbinary(max) in the database. I'll be using the thumbnails in a gallery-style view, so small size / efficient loading is crucial. I've been using an .ashx to return the full size image into a bound asp.net Image control, with the following code:

Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim conn As New SqlConnection()

[Code]....

I realize it's probably best to address the re-size at the upload, and stored the smaller image as a discrete column. But in the meantime, is it possible to program the handler to re-size the image on the fly? Ideally, I'd be able to pass an additional query string parameter, something like isResized from the image binding, allowing the same handler to be used for both full size and re-sized images.

View 3 Replies

Linq To Jquery With Jquery Ver Jquery-1.7.2?

May 11, 2012

this is my class:

Public Class Employeeclass
Public Property Fname As String
Public Property Lname As String
Public Property Bdate As Date
End Class

[Code]...

View 3 Replies

C# - Setting File Upload Size Through JQuery

Jan 13, 2012

I have FileUpload Control on my Page:
<asp:FileUpload runat="server" ID="fuAttachment" CssClass="fileUploadCSS" size="76" />

I want to change size of this Control on Button's Click event though Jquery. How do i set it? because
($("#fuAttachment").size
Doesn't working. and
($("#fuAttachment").width returns null

View 2 Replies

Javascript - Pass JSON File From ASP.NET To JQuery?

Feb 27, 2012

my problem is that my company does not want to serve up the .json MIME type, so I have to use ASP.NET to fetch the JSON file from the file server. Currently I have jQuery that does a getJSON and traverses the JSON object to build certain elements of the page. Is there a way I can use ASP.NET (VB) to give the object to my jQuery script after I fetch it?

View 1 Replies

Reading JQuery File Over HTTPS Causing Access Denied

Nov 17, 2010

We have a site that is public facing, let's say it's [URL]. When the SSL is implemented, [URL], I can no longer access the jQuery 1.4.3 file on my own server. Furthermore, after a tweak to the security setting, I was able to get past the 'Access is Denied' error, but the first call was null. I understand there is a problem with different protocols actually being within the scope of the cross-domain problem? Is that true? And if so, will this now require JSONP?

<script type="text/javascript" src="<%= ResolveUrl("~/js/jquery-1.4.2.min.js") %>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/js/jquery.jstree.min.js") %>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/js/jquery.dataTables.min.js") %>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/js/jquery.cookie.min.js") %>"></script>

View 2 Replies

Jquery - Passing Client Data To Server To Create Excel Or CSV File?

Jan 9, 2012

I'm creating a reporting web page as part of a standard VB.NET web application. The page is data driven, with jquery making calls to a web service local to the application to get values of elements that are dynamically created in the DOM. Ultimately these dynamic elements and their values are all wrapped up in a JSON object, so that part of the client side is fine.

Right now, I can pass that JSON object to a method in the web service which creates an SQL Data adapter from the values and queries a database. My ultimate goal is to have this client JSON data be used to query the database and construct an excel file to send back to the user, or failing that a CSV file.

It's my understanding (from working with PDF file generation) that this type of function can only be done on the server side of the web application, not even from the web service (i.e. I can't have the web service return an array of bytes and have JavaScript/jQuery present that as a file).

So, how do I go about this? Now I have my JSON object on the client side, where should I be sending it, how, and how do I go about returning my file?

I've read about either storing the JSON in a hidden field and having the server take the elements value and go from there, or using AJAX to send the JSON to the server just before a postback is made to fire off the server-side function to run the query and return the data.

I just need a little guidance, and a little help understanding where to use the hidden field, or what I am actually doing with the pre-postback AJAX call.

View 1 Replies

Post A XML File To A HTTPS Url?

Apr 26, 2010

Here's what I did i VB 6 and I want to do the same in vb.net

Dim obj As MSXML2.XMLHTTP60
Dim request_string As String
obj.Open "POST", "https://apitest.authorize.net/xml/v1/request.api", False

[Code].....

View 2 Replies

Use Webbrowser.navigate To Post A File?

Jan 13, 2012

I need to send a pdf file to a web page in VB.net. I found that there is a webbrowser control and I should be able to use the navigate() method to do it.However, there is no sample for doing so.

View 5 Replies

VB HTTPS Post Tab Delimited File

Mar 14, 2012

I need to post a tab delimited file via the https post request. I need to be able to do this in asp.net VB. I have found various methods in C# however as I am still rather new to asp.net VB I certainly do not have the ability to translate the C# version. The link it posts to is password and username protected. I need to post the file in the message body. Below is an example request that it needs to produce: [Code]

View 1 Replies

Make A Program That Allow To Post A Quote Out Of A File?

Jan 16, 2010

how do make a program that allows me to post a quote out of a file and put it on todays quote and a new one will come up

View 2 Replies

C# - POST File - Not From Client Machine, From Web/ftp Server?

Jan 22, 2010

I'm using .Net. Is it possible for a web form to upload an image from a web or FTP server? The files I need to submit are on the web.

View 1 Replies

Post Links To Download The Exe File And Also The Project?

Sep 6, 2009

this is the link to download part of the project (638KB):[URL]..and here, the exe file, complete (8MB):[URL]..You will need a MIDI instrument connected with you computer, like a MIDI musical keyboard. On software, click with the right button on the form, and in the menu choose the instrument.

In the project I need help for: understand why the event TouchOff is not working. The event TouchOn is working, when you press a key in the MIDI musical keyboard so the virtual piano in the software will show a pressed key. But the event TouchOff is not working. when a key of the Midi musical keyboard is pressed, and if checkbox1 is checked, then the timer1 will be enabled

View 1 Replies

Resource File Post-removal Error

Oct 28, 2009

I had this little image file that i was working out for using in my program but after deleting the reference to it in the my project>resources tab and its gone from the saved folder and solution window, but...

it know has errors about it still having a link to that file but its now missing

View 1 Replies

Send The MMS With Smil File By HTTP Post?

Mar 11, 2010

i was doing an application that can send the MMS with smil file by HTTP post . but i could not get any sample source code that can refer. Does kindly help for anyone was involve in this kind of development

View 1 Replies

Win Form App (local) Needs To POST File To Webserver

May 28, 2010

I'm successfully communicating string data to and from with a webserver using the System.Net.WebClient and the Upload method. Now I'd like to be able to upload files from my local app to this webserver. I get that it's probably very similar to what I'm doing with the string data, but I've not done anything with files that aren't ascii based so am hesitant as where to begin. I don't want to corrupt the file.

View 3 Replies

POST Data And Upload File Using Webclient Or HttpWebRequest

Jul 24, 2009

I have the following HTML Form That I'm trying to automate:

<html>
<body>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data"

[Code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved