CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2008_express Tags:
Item Type: NewsGroup Date Entered: 1/20/2008 3:35:26 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 24 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
mallyonline
Asp.Net User
Create & Download Document At RunTime1/20/2008 3:35:26 PM

0/0

Hi

Firstly I am using FreeTextBox to edit a document in the browser. I wish to provide the function to user where they can choose to either save to the server or download to the desktop... I am having a small problem with my code... The file opens ok but the document includes not only the content from my textbox but also the whole pages html.

the code --  

17               'Try to write the file to the stream for user download. 
18               Try
19                   If DropDownSaveTo.SelectedValue = ("Desktop") Then
20                       '' Open the stream and read it back.
21                       fsdoc = File.Open(doc, FileMode.Open, FileAccess.Read)
22                       Response.AddHeader("Content-Disposition", "attachment; filename=" & docname.Text & DropDownList1.Text)
23                       Response.ContentType = "text/octet-stream"
24                       Dim b(1024) As Byte
25                       Dim temp As UTF8Encoding = New UTF8Encoding(True)
26                       Dim sw As New StreamWriter(Response.OutputStream)
27   
28                       Do While fsdoc.Read(b, 0, b.Length) > 0
29                           sw.Write(temp.GetString(b))
30                           sw.Close()
31                       Loop
32                       fsdoc.Close()
33                   End If
34               Catch ex As Exception
35                   Response.Write(ex)
36           End If

 This has the effect of writing the document from the contents of freetextbox and then downloading the document.... problem is the document looks something like  

FTBv3-1-6/editor.aspx?info.text=Done'>Welcome to Document Editor 
User Interface version 1.0. To get started simply use the buttons 
to edit, save or print documents in this window.


<input type="hidden" name="__WPPS" id="__WPPS" value="u" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
When it should look like  
Welcome to Document Editor User Interface version 1.0. 

To get started simply use the buttons to edit, save or print 
documents in this window.
 
Anyone any ideas ? 
 
regards 
mal 
 
 

Confused, Delighted, Sad, Elated ? is that not a programmers job description!!
Hong-Gang Chen
Asp.Net User
Re: Create & Download Document At RunTime1/22/2008 1:22:34 AM

0/0

Hi mal,

Base on my experience, you can use regular expression(<[^>]*>) to solve your problem, see the following demo:


    protected void Page_Load(object sender, EventArgs e)
    {
        string HTML = @"
                        <form id='form1' runat='server'><div>
                        <asp:TextBox ID='txtAnimalID'runat='server'>I </asp:TextBox>
                        <asp:TextBox ID='txtCordX' runat='server'>Love </asp:TextBox>
                        <asp:TextBox ID='txtCordY' runat='server'>ASP.NET</asp:TextBox>
                        </div></form>";
        HTML = GetTextFromHTML(HTML);
    }

    string GetTextFromHTML(string strHtml)
    {
        string temp = System.Text.RegularExpressions.Regex.Replace(strHtml, "<[^>]*>", "");
        return temp.Replace(" ", " ");
    }

NOTE: Running above code, the HTML variable will get "I Love ASP.NET", there is no any HTML tag in it.

Let me know if I have misunderstood what you mean. Thanks.

Hope it helps,

Hong Gang 


Sincerely,
Hong Gang Chen
Microsoft Online Community Support
Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Hong-Gang Chen
Asp.Net User
Re: Create & Download Document At RunTime1/22/2008 1:26:52 AM

0/0

Hi mal,

Sorry, it seems you are familiar whit VB, but I am familiar with C#, but do not worry, you can use this to convert my code to VB if you do not familiar with C#:

http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx

Let me know if I have misunderstood what you mean. Thanks.

Hope it helps,

Hong Gang 


Sincerely,
Hong Gang Chen
Microsoft Online Community Support
Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
mallyonline
Asp.Net User
Re: Create & Download Document At RunTime1/26/2008 2:29:06 PM

0/0

Hi Hong Gang.

Thanks for the reply. I think you did understand my question very well! I used the covert function to see the vb.net code

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 
    Dim HTML As String = "" & Chr(13) & "" & Chr(10) & " <form id='form1' runat='server'><div>" & Chr(13) & "" & Chr(10) & " <asp:TextBox ID='txtAnimalID'runat='server'>I </asp:TextBox>" & Chr(13) & "" & Chr(10) & " <asp:TextBox ID='txtCordX' runat='server'>Love </asp:TextBox>" & Chr(13) & "" & Chr(10) & " <asp:TextBox ID='txtCordY' runat='server'>ASP.NET</asp:TextBox>" & Chr(13) & "" & Chr(10) & " </div></form>" 
    HTML = GetTextFromHTML(HTML) 
End Sub 

Private Function GetTextFromHTML(ByVal strHtml As String) As String 
    Dim temp As String = System.Text.RegularExpressions.Regex.Replace(strHtml, "<[^>]*>", "") 
    Return temp.Replace(" ", " ") 
End Function 

 I have yet to get back to my project to test this and will get back to you asap.

Kind Regards

Mal

 


Confused, Delighted, Sad, Elated ? is that not a programmers job description!!
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Red Hat Enterprise Linux & Fedora Core 4: The Complete Reference Authors: Richard Petersen, Pages: 915, Published: 2005
Developing Killer Web Apps with Dreamweaver MX and C# Authors: Chuck White, Pages: 409, Published: 2004
Java For Dummies Authors: Barry Burd, Aaron E. Walsh, Pages: 360, Published: 2007
VBScript Programmer's Reference: Programmer's Reference Authors: Adrian Kingsley-Hughes, Daniel Read, Pages: 773, Published: 2007
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Internet Applications with Visual FoxPro 6.0 Authors: Rick Strahl, Pages: 400, Published: 1999
Fedora Core 7 & Red Hat Enterprise Linux: The Complete Reference Authors: Richard Petersen, Pages: 1008, Published: 2007
Beginning Cryptography with Java Authors: David Hook, Hook, Inc Books24x7, Pages: 448, Published: 2005
XML Primer Plus: Primer Plus Authors: Nicholas Chase, Pages: 993, Published: 2003
Programming Flex 2: The Comprehensive Guide to Creating Rich Internet Applications with Adobe Flex Authors: Chafic Kazoun, Joey Lott, Peter Hall, Pages: 472, Published: 2007

Web:
FDSE :: Help :: Indexing Microsoft Word documents using runtime ... Jul 5, 2002 ... Indexing Microsoft Word documents using runtime conversion with Antiword .... Next, create a realm named "Binary Conversion Test" which will ...
#200041: Security Vulnerabilities in Java Runtime Environment May ... Oct 3, 2007 ... SA Document Body Security Vulnerabilities in Java Runtime Environment May Allow ... JDK and JRE 6 Update 3 is available for download at: ...
Creating Web services with the Apache Axis2 runtime environments Unlike creating Web services in the Apache Axis1.x runtime, before creating a Web service using Apache Axis2 you must download the Axis2 runtime and install ...
Forum Nokia - Web Technologies Documentation Working with Pepsi Latin America, Forum Nokia helped to create the Pepsi “Kung Fu .... This document gives a brief introduction to the Web Run-Time concept, ...
PluginDoc: Linux (x86) Create a symbolic link to nppdf.so to your Mozilla plugins directory. ... Download Curl Runtime Environment .... Note: The author of this document is a current CodeWeavers customer and advocate for Windows Media Player 9 series. ...
[VBA/VB6] My Documents + Environment Variables - The solution Nov 19, 2008 ... Creating a variable from a txt file Hello, I want to make a batch file that ... DOCX documentHow to read a .DOCX document Download Microsoft ...
UDN - Two - UnrealEngine2Runtime22262002 Document Summary: Introduction to version 2226.20.02 of the UnrealEngine2 Runtime edition .... If you would like to create new DLLs and interfaces for your Runtime projects, ... Make sure to download the "Runtime" versions of each one. ...
How to Create a Multilingual Run-time Image Using MUI This document provides detailed steps about how to create a multilingual Enterprise Web Pad OS design. ... 4. Download your run-time image to the Emulator. ...
Macros Runtime Download and Review - Active X - SoftAhead Print Page Download PDF File Download Macros Runtime 1.7 PDF File ... Create full featured buttons in all styles (XP, Office 2003, shaped) that support ... Office ActiveX Control acts as an ActiveX document container for hosting Office ...
Reducing the LabVIEW Run-Time Engine Installer Size - National ... Apr 17, 2008 ... For example, if you are creating an installer and select to only install only the LabVIEW Run-Time Engine ... The download for the full LabVIEW 8.5 run-time engine is 97 MB. ... Document needs work? Please tell us why. ...

Videos:
Glimpse Inside a Metaverse: The Virtual World of Second Life Google TechTalks March 1, 2006 Philip Rosedale and Cory Ondrejka ABSTRACT Linden Lab is the producer of Second Life, an online world with ...
XML11: An Abstract Windowing Protocol Google TechTalks June 1, 2006 Arno Puder Arno Puder received his masters and Ph.D. in computer science and is currently working as an ...




Search This Site:










reject simultaneous access from the same member account ?

custom membership and custom role provider problems

program administrative mernu selection

how to filter a query using the logged in username or id ?

implementing membership & roles on an external db

windows password popup problem

internal application - how to secure login

admin login

logout problem

identity username - with windows authentication

web site administration tool and web application project

problem adopting asp.net web site configuration tool code

email validation doesn't work in createuserwizard

authentication failure after migration of 2.0 web app to 3.5

menu control / web.sitemap / securitytrimmingenabled

impersonation problem on w2k

trouble with iwa - authenticating to intranet web server name instead of domain?

formsauthentication logout not working

how to populate database with user info (password/username) on the fly...

forcing the user to go the the default.aspx page first

file upload on remote server and impersonation

user names are not case sensitive for sqlmembership provider in asp.net 2.0?

problem with returnurl

help with accessing folders outside of the website using windows authentication and active directory

ad authentication doesn't work on a windows 2003 server

multi role

system.security.securityexception: request failed.

an item shows on the menu when not spposed to show

error on ewp while hosting

security and role management problem

  Privacy | Contact Us
All Times Are GMT