473,396 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

POST & GET Behaviour

I created a sample aspx page with a server side Button Control. OnClick event of Button streams an excel file to the client via the following code..
response.Buffer =true
response.Charset = ""
response.ContentType = "application/vnd.ms-excel";
response.AppendHeader("Content-Disposition", "attachment;filename=sample.xls")
response.Write(data)

If the above page is accessed and button is clicked, IE browser throws up TWO Open/Save Dialog boxes.

If i change the "form" attribute "method" to "GET" instead of "POST", IE browser prompts the user with only ONE Open/Save Dialog box. However i like to have the form to have POST mechanism rather than GET and at the same time want the browser to prompt the user only once with Open/Save Dialog box... Any ideas

Thank
Krishn
Nov 18 '05 #1
6 960
Do you have a public url which exhibits this? I'd like to take a look.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Krishna" <an*******@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
I created a sample aspx page with a server side Button Control. OnClick event of Button streams an excel file to the client via the following
code... response.Buffer =true;
response.Charset = "";
response.ContentType = "application/vnd.ms-excel";
response.AppendHeader("Content-Disposition", "attachment;filename=sample.xls"); response.Write(data);

If the above page is accessed and button is clicked, IE browser throws up TWO Open/Save Dialog boxes.
If i change the "form" attribute "method" to "GET" instead of "POST", IE browser prompts the user with only ONE Open/Save Dialog box. However i like
to have the form to have POST mechanism rather than GET and at the same time
want the browser to prompt the user only once with Open/Save Dialog box...
Any ideas?
Thanks
Krishna

Nov 18 '05 #2
Hi Eric
Thanks for your time.Unfortunately this is not in public domain. But i can provide test file (one aspx page with a server side button & aspx.cs class with event procedure for Button control)

SamplePage.asp
--------------------
<%@ Page language="c#" Codebehind="SamplePage.aspx.cs" AutoEventWireup="false" Inherits="SampleReport.SamplePage" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><HEAD><title>SamplePage</title><meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" Content="C#"><meta name="vs_defaultClientScript" content="JavaScript"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"></HEAD><body MS_POSITIONING="GridLayout"><form id="Form1" method="get" runat="server"><asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server
Text="Button"></asp:Button></form></body></HTML
SamplePage.aspx.c
-----------------------
using System
using System.Collections
using System.ComponentModel
using System.Data
using System.Drawing
using System.Web
using System.Web.SessionState
using System.Web.UI
using System.Web.UI.WebControls
using System.Web.UI.HtmlControls

namespace SampleRepor

/// <summary
/// Summary description for SamplePage
/// </summary
public class SamplePage : System.Web.UI.Pag

protected System.Web.UI.WebControls.Button Button1

private void Page_Load(object sender, System.EventArgs e

// Put user code to initialize the page her
#region Web Form Designer generated cod
override protected void OnInit(EventArgs e

/
// CODEGEN: This call is required by the ASP.NET Web Form Designer
/
InitializeComponent()
base.OnInit(e)
/// <summary
/// Required method for Designer support - do not modif
/// the contents of this method with the code editor
/// </summary
private void InitializeComponent(
{
this.Button1.Click += new System.EventHandler(this.Button1_Click)
this.Load += new System.EventHandler(this.Page_Load)
#endregio

private void Button1_Click(object sender, System.EventArgs e

Response.Buffer =true
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment;filename=sample.xls")
Response.Write("<table><tr><td>a</td><td>a</td></tr>")
Response.End()
}
Nov 18 '05 #3
SamplePage.aspx provided in previous post has <method> attribute of form set to "GET". The problem occurs when the attribute is "POST"

Thank
Krishna
Nov 18 '05 #4
Parser Error Message: Could not load type 'SampleReport.SamplePage'.

-E

"Krishna" <an*******@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
SamplePage.aspx provided in previous post has <method> attribute of form set to "GET". The problem occurs when the attribute is "POST".

Thanks
Krishna

Nov 18 '05 #5
Well, I am sorry for not mentioning about the "namespace". "SampleReport" is the namespace. You can do global replace of "SampleReport" with what ur namespace you have created. Let me know if u still face problem

Thank
Krishna
Nov 18 '05 #6
I simply copied and pasted your text into two files and hit the ASPX page.
(This copy/paste preserved the namespace declarations in the .CS file, so
I'm not sure what else to change.)

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Krishna" <an*******@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Well, I am sorry for not mentioning about the "namespace". "SampleReport" is the namespace. You can do global replace of "SampleReport" with what ur
namespace you have created. Let me know if u still face problem.
Thanks
Krishna

Nov 18 '05 #7

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

Similar topics

4
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most...
4
by: Glutinous | last post by:
I've been studying this for hours, searching the www & usenet, and still can't figure out why 'each' returns an array of four key/value pairs, when it looks like just two pairs would suffice... ...
11
by: brendan | last post by:
Sorry this isnt a cross post .. i just didnt get any help from alt.php. I have a website which utilises post forms for navigation in some areas. Problem is, when *some* users hit the BACK button...
0
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a...
24
by: abracad_1999 | last post by:
I'm told the standards way of referencing page content is document.getElementById() What is the lowest version of each browser type with which this will work? Thank you
6
by: snt | last post by:
I have a C# asp.net project in which I create meta keywords dynamically. I have a problem with "&" character. When the page is rendered, the "&" character is converted into "&amp;". Is there any...
30
by: fritz-bayer | last post by:
Hi, why does the php expression $result = 5543039447 & 2147483648; when executed evaluate to 0, whereas the perl expression $same = 5543039447 & 2147483648 ;
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
23
by: Hallvard B Furuseth | last post by:
As far as I can tell, (x & -1) is nonzero if the integer x is negative zero. So for signed types, x == 0 does not guarantee (x & foo) == 0. Is that right? (Not that I expect to ever encounter a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.