Send Data To Ashx - Handler But Not Query String?

Dec 22, 2010

I would like to open some page from external web-application in iframe. Usualy, I would indicate URL for iframe like this: URL = [URL] BUT. I need to send not only 'ID=12' parameter. I need to send a lot of data to handler in order to be processed. Usualy I do it by following code:

Dim wrq As WebRequest = WebRequest.Create(Data_WS_URL) wrq.Method = "POST" Dim postData As String = "PubmedIDs=" & vInput wrq.ContentType = "Application/x-www-form-urlencoded" Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)

But when you use this code - you recieve response from webrequest as some amount of data - text or binary. I may write this respone to the place on the page where I wanted to have iframe. But response cannot always be accaptable. (for example - I render asp:Treeview by ASHX handler - when I do to ashx page - it renders well, collapse-expand works fine; but if I write web-response of ashx page as text/html - then there's something wrong with javascript, tags ids and collapsing nodes). And webresponse cannot be represented as as URL. How to combine this two approaches

1) Clear URL which can be set as source for iframe
2) Extra data for web-request, larger then QueryString can handle

View 6 Replies


Similar Messages:

Send Data To An Ashx Handler?

Nov 9, 2010

How can i send data to an asp.net ashx handler? for instance if i want to send some xml to asp.net hanlder how is that possible?

View 2 Replies

Forms Data Controls :: Invoking A Handler With A Parameter In Its Query String

Mar 22, 2010

I'm having troubles passing a parameter to a handler in it's query string. I have a gridview with an image column, this column is defined as a TemplateField, as:

<asp:TemplateField
HeaderText="Image">
<ItemTemplate>
<asp:Image
ID="Image1"
runat="server" ImageUrl='~/ImageHandler.ashx?ID=<%# Eval("EmployeeID")%>'
/>
</ItemTemplate>
</asp:TemplateField>

As you can see, the ImageUrl is a call to a handler that receives the EmployeeID in the QueryString, under the name ID. When I run it, the ImageHandler method receives the following query string "ID=<%" instead of "ID=<the result of Eval("EmployeeID")>", and of course, it throws a FormatException when using it as an int to get the EmployeeID. (If I type ImageUrl="~/ImageHandler.ashx?ID=<%# Eval("EmployeeID")%>" (using " instead of ') the compiler returns the error incorrect server tag) The complete markup is:

<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%&#36; ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Photo] FROM [Employees]">
</asp:SqlDataSource>
<asp:GridView
ID="GridView1"
runat="server" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField
DataField="EmployeeID"
HeaderText="ID" SortExpression="EmployeeID"
/>
<asp:BoundField
DataField="FirstName"
HeaderText="FirstName"
SortExpression="FirstName"
/>
<asp:BoundField
DataField="LastName"
HeaderText="LastName" SortExpression="LastName"
/>
<asp:TemplateField
HeaderText="Image">
<ItemTemplate>
<asp:Image
ID="Image1"
runat="server" ImageUrl='~/ImageHandler.ashx?ID=<%# Eval("EmployeeID")%>'
/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Could anybody tell me what am I missing here?
Rafael

View 1 Replies

C# - Query String To Handler Page

Dec 5, 2010

How do I create a query string from photopath on my database.aspx page to my handler.ashx page. I want the handler page to pick up on my photopath string contained here:

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string PhotoPath;
GridViewRow row = GridView1.Rows[GridView1.SelectedIndex];
PhotoPath = row.Cells[5].Text;
PhotoPath = HttpUtility.UrlEncode(PhotoPath);
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(PhotoPath);
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
Stream resStream = response.GetResponseStream();
using (System.Drawing.Image img = System.Drawing.Image.FromStream(resStream))
{
img.Save("temp.jpg", ImageFormat.Jpeg);
}
}
}
}
}
}
}
and then to retrieve it in my GetImage.ashx handler page here:
public class GetImage : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
{
string PhotoPath = System.Web.HttpContext.Current.Request.QueryString["PhotoPath"];
PhotoPath = HttpUtility.UrlDecode(PhotoPath);
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri(PhotoPath));
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential("Administrator", "commando");
try
{
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
byte[] bytes = new byte[2048];
int i = 0;
MemoryStream mStream = new MemoryStream();
do
{
i = stream.Read(bytes, 0, bytes.Length);
mStream.Write(bytes, 0, i);
} while (i != 0);
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.ContentType = "image/jpeg";
context.Response.BinaryWrite(mStream.GetBuffer());
}
catch (WebException wex)
{
//throw new Exception("Unable to locate or access your file.\nPlease try a different file.");
}
catch (Exception ex)
{
throw new Exception("An error occurred: " + ex);
}
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}

View 1 Replies

Web Forms :: How To Send A String Consists Of (,.&') In A Query String

Dec 7, 2010

Is It Possible to send a string consists of (,.&') in a query string ?

View 7 Replies

Forms Data Controls :: Displayng Pictures Into A Gridview With Handler.ashx?

Apr 9, 2010

I recently made an application which displays pictures into a gridview in a very easy and quick way.I have now a problem. I would like to bind the pictures the user sees to the membership schema so that each authenticated user can see his/her own pictures only.I will post some code that can be helpful to somebody who is trying to display pics in a gridview and that,Database:

Trip_Id= int
TripLocation = nvarchar(50)
ImageData = varbinary(Max)

[code]...

View 7 Replies

Conversion From String "Handler.ashx?id=" To Type "Double" Is Not Valid

Dec 15, 2010

I am wishing to retrive picture stored in sql server database to web form using gridview control. I have created a Handler.ashx file with following coding:

[Code]....

And in the aspx page I am calling this as:

[Code]....

But when I am executing this project, it prompts following error:

[Code]....

View 3 Replies

Send Encrypt Query String

Feb 19, 2011

Iam trying to send EmployeeId in another page using query string but i want to send it in encrypted format.

View 3 Replies

How To Send A Hyperlink Using Query String Method

Aug 27, 2010

I want to send hyperlink by attach it with URL with the of query string method. For instance in a web page containing three links like

[URL]

now suppose user click on yahoo.com at this point i want to send it by attaching with url like [URL]......some thing like that

View 1 Replies

ASHX Handler; Fires Up Only Once?

Jun 23, 2010

I've got a simple ASHX handler that returns an dynamically generated image; the image is generated from a custom created class, and an object belonging to this class is passed to the handler using Session (I'd rather avoid using QueryString).The handler is used as the URL of an image on a ASP form which is very simple: a drop down list, a button and an image. Basically, depending on what the user selects from the list, the appropriate image will be generated once the button is pressed.

At the start the actual image has it's Visible property set to false; I don't want the handler to display anything before the data is all there.Once the button is pressed, the required Session parameter is added containing the necessary object, and the page is refreshed using Server.Transfer. When the Page_load method detects that the Session parameter has been correctly set, it sets the Visible parameter on the image to true.After that the handler fires up and generates the image.

So far so good... However, if the user now picks something different from the list and presses the button, despite the correct object being passed in the Session, the image won't be updated. In fact, the handler won't even fire up (if I put a breakpoint in there). I need to close the browser window and reopen it for it to work.Any ideas what could be the cause of such behaviour?I suspect the answer is very simple, and I just don't know something fundamental about ASP (or handlers)...

View 1 Replies

MVC :: How To Send Parameter In Query String On Ajax Call

Oct 8, 2010

I want to send selected page value on querystring while navigating through paging. URL that is generating on paging are like this

[Code]....

View 1 Replies

What Is The Purpose Of Handler (.ashx Files) And What Is The Use

Jan 10, 2011

What is the purpose of Handler (.ashx files) and what is the use ?

can i get any sample ?

View 1 Replies

Disable Gzip For Just One Handler .ashx?

Sep 14, 2010

I am running a website using IIS6 and i wrote a simple generic handler which return smaller images when it receive image url as query string. My problem is that the server is applying gzip to some file types such as .aspx and .ashx. And that made my response image from the handler appear with lower quality because they are compressed.

How can i disable gzip for just this handler file, i hope for a solution without editing the IIS.

View 1 Replies

Web Forms :: How To Send Values In Query String Using Windows.form

May 19, 2010

i am working on a web form. now i am opening a pop up window using window.open. Now i want to send the id to that new window. the link button is in my Data list view so that my code is something like this:

<asp:LinkButton id="checkdetsail" runat="server" Text="Show Image >>>" OnClientClick="window.open('Images.aspx?aid=<%# DataBinder.Eval(Container, "DataItem.StoreCode") %>' ,null, 'height=550, top=100, left=200, width=900, status=no, resizable= no, scrollbars=
yes, toolbar= no,location= no, menubar= no')"></asp:LinkButton>

but this is not working. solve my problem.

View 5 Replies

HttpHandlers / Modules :: How To Send An Email With Information In Query String

May 13, 2010

First I will say I googled (Binged to make Bill happy) for this but could not find anything, perhaps I am not stating what I need correctly;

I have a website that a customer creates orders (for a printing company) and after the order, I would like to email the customer a link to view the status of their order;

I need to send the CustomerID in the link so on the returning page if a CustomerID is detected in the querystring, I "auto login" the client and open the "Dashboard" for the order page for that customer.

Can anyone point me in the right direction as to how to send the link and how to parse the querystring to get the values from the link.

View 8 Replies

C# - ASHX Image Handler Works With Chrome Not IE8?

Jul 25, 2010

I've created code to retrieve an image from the file system using an ASHX handler. The code displays the image correctly in Chrome, but I get a broken image in IE:

[Code]....

View 2 Replies

JQuery :: Validate Request And Web Handler(ashx)

Jun 24, 2010

I have a webpage where I am displaying some data.

On the top of that I have a button. On click of this button I am calling my webhandler using jquery/json, passing in some data to this handler. Now this data can containg html tags. So whenever I try to click that button it gives that Potential threat script

error. So I thought let me include ValidateRequest = false to my webpage.

Now when i do this it never hits my handler. I tried to debug also but my breakpoint is never hit in my handler. How to handle this.

This is how I call my handler:

[Code]....

where hidden value is the value which I want to pass to my handler and may contain html tags..

View 2 Replies

Can I Call/request A .net Handler (ashx) Using Javascript

May 19, 2010

Is it possible to call a handler using javascript code? e.g. i have a handler deployed at this location http://mysitename.com/getMyData.ashx. Can I call this handler or just request it using javascript?

View 3 Replies

HttpHandlers / Modules :: Pass Two Variables To A Handler.ashx??

Jul 27, 2010

I have a gridview and in it is code to display an image

[Code]....

This works fine for pass one variable. but I need to send two variables 'ImageNum' and 'refID' to the Handler.ashx page, any ideas how, tried a few things in last few hours and as yet no joy!

View 4 Replies

HttpHandlers / Modules :: Adding A Messagebox To An ASHX Handler

Nov 18, 2010

Is it possible to add a messagebox to an ASHX Handler? I used a handler to pass data from a Web Service to an internal system and need a messagebox to pop up to ask the user to choose from one option or another.

View 2 Replies

Web Forms :: Proper File Serve Of An ASHX Handler

Apr 30, 2010

For our application we provide users with file downloads that utilize handlers to serve the files. Currently, the way it is served to the user is through window.location. When using this, at times, it causes issues under IE8. When an error occurs, it cannot be caught under the page that called it.


A) Is there a way to serve an ashx file handler to the user where the page that called it can catch any exceptions made from thje handler
B) What is the correct way to serve the handler, eg. window.open, window.location, etc. Would return false at the end of the javascript solve this? Are there any other ways

View 2 Replies

Determine HTTP Protocol Version In ASHX Handler?

Sep 17, 2010

Is it possible to determine the HTTP protocol version (e.g. 1.0 vs. 1.1) used for a request within a .ashx handler? I can see all of the header information except for the version in Request.Params.

If not, what avenues are available to discover the HTTP protocol version when processing an HTTP request in ASP.Net?

View 1 Replies

Ashx Handler Prompting Download Instead Of Displaying File?

Aug 10, 2010

implemented a generic handler in my application which works great for images, but when I manually type the handler URL in the browser with the image's querystring it prompts download instead of displaying. Here is my code:

public void ProcessRequest(HttpContext context)
{
if (this.FileName != null)
{

[code]...

View 3 Replies

Session Not Working In Generic Handler .ashx In Firefox?

Apr 28, 2010

I have created .ashx which implemented IRequiresSessionState, so I can create session variables in that ashx, it worked in IE, but doesn't work in Firefox.When access this session variable from other pages it's NULL.

View 1 Replies

Supporting Resumable HTTP - Downloads Through An ASHX Handler

Mar 25, 2011

We are providing downloads of our application setups through an ASHX handler in ASP.NET.

A customer told us he uses some third party download manager application and that our way of providing the files currently does not support the "resume" feature of his download manager application.

My questions are:

What are the basic behind resuming a download? Is there a certain HTTP GET request that tells me the offset to start at?

View 1 Replies







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