CommonDialog asp.Net

Results 1 to 2 of 2

Thread: CommonDialog asp.Net

  1. #1
    Join Date
    Dec 1969

    Default CommonDialog asp.Net

    Hi! in my web page, I hv a button "save" to save the current page to html format. <BR>------------------------------------<BR>Imports MSComDlg.CommonDialogClass<BR>.<BR>.<BR>.<BR>Priva te Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click<BR> Dim CommonDialog1 As MSComDlg.CommonDialogClass<BR> CommonDialog1 = New MSComDlg.CommonDialogClass()<BR> With CommonDialog1<BR> .Filter = "HTML Files&#124*.html"<BR> .ShowSave()<BR> MsgBox(.FileName)<BR> End With<BR> End Sub<BR><BR>--------------------------------------------<BR><BR>But the page give me error below:<BR><BR>Server Error in &#039;/AMEQ&#039; Application.<BR>--------------------------------------------------------------------------------<BR><BR>Exception from HRESULT: 0x800A7FFD. <BR>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <BR><BR>Exception Details: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A7FFD.<BR><BR>Source Error: <BR><BR><BR>Line 91: With CommonDialog1<BR>Line 92: .Filter = "HTML Files&#124*.html"<BR>Line 93: .ShowSave()<BR>Line 94: MsgBox(.FileName)<BR>Line 95: End With<BR> <BR><BR>Source File: c:inetpubwwwrootAMEQIndividualaa.aspx.vb Line: 93 <BR><BR>Stack Trace: <BR><BR><BR>[COMException (0x800a7ffd): Exception from HRESULT: 0x800A7FFD.]<BR> MSComDlg.CommonDialogClass.ShowSave() +0<BR> AMEQ.aa.btnSave_Click(Object sender, EventArgs e) in c:inetpubwwwrootAMEQIndividualaa.aspx.vb:93<BR> System.Web.UI.WebControls.Button.OnClick(EventArgs e)<BR> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)<BR> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)<BR> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)<BR> System.Web.UI.Page.ProcessRequestMain()<BR><BR>--------------------<BR><BR>Anyone knows how to correct the error? thanks<BR><BR>rgds,<BR>mae

  2. #2
    Join Date
    Dec 1969

    Default RE: CommonDialog asp.Net

    ASP.NET is cool, but not that cool. As far as I know, you still cannot do things like that on a client machine via a web page. <BR><BR>If all you want to do is let the user download some text data, you can stream data to the Response object, with the appropriate header information. Try something like this:<BR><BR>Page.Controls.Clear();<BR>Response.Co ntentType = "text/plain";<BR>Response.AddHeader("content-disposition", "attachment; filename=whatever.txt");<BR>Response.Write(yourDat aHere);<BR>Response.End();<BR><BR>Upon receiving this, the browser should invoke it&#039;s own dialog box asking where to save it.<BR><BR>Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts