How to append string to Response.OutputStream after string converted to byte array

Hi,

I am trying to append string to Response.OutputStream property in PostRequestHandlerExecute event handler inside custom httpmodule. The goal of this implementation is to append string to output stream after the page is rendered when the response object is still held on the server. The pseudo code I wrote is the following:

private void PostRequestHandlerExecute(object sender, EventArgs e)

{

HttpApplication application = ( HttpApplication ) sender;

HttpContext context = application.Context;

 

string s = "This is test!";

byte[] buffer = Encoding.ASCII.GetBytes(s);

 

context.Response.OutputStream.Write( buffer,0, buffer.Length );

}

 However, it does not work. I am not sure whether this implementation is feasible  or not. Anyone can help?

 Alex

 

 

 

0
alexwang
11/17/2006 11:16:02 PM
asp.net.handlers-modules 2116 articles. 0 followers. Follow

0 Replies
1402 Views

Similar Articles

[PageSpeed] 9
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

Convert string to string array.
Hi, We have a string array argument in datawindow object for 'IN' sql statement. Our user enter a string in a single line edit. How to convert the string to a string array for the argument of datawindow? ex. user input : 'A', 'B', 'C' => str_arr[]={'A', 'B', 'C'} dw_1.retrieve(str_arr) Thanks in advance. Take a look at the n_cst_string object in the pfc. It has a method called of_ParseToArray that does exactly what you're looking for. It's a pretty simple task to 'port' the code ...

String to Linq.Byte and Linq.Byte to String convertion?
 Hi, I have a field in my database as image type. I am using Linq to read/insert records.I am having little hard time inserting text(string) into the image field and then converting back to string.Do you have any suggestions? Thanks in advance,   The below example shows how to convert Linq Binary to byte If Not String.IsNullOrEmpty(HttpContext.Current.Request.QueryString("imageID")) Then Dim imageID = HttpContext.Current.Request.QueryString("imageID") Dim db As New AuctionsDataContext Dim result = From img In db.Image...

RSA Encryption
Here is my goal:1. Take a string2. Encrypt it 3. Pass it as a parameter in the QueryString4. Decrypt it The value starts as a string, then is converted to a byte[] and then encrypted.  The resulting byte[] is converted to a string and send as a parameter.  The recieving page decrypts the string (creates a byte[], decrypts to a new byte[], and the value is finally parsed for its values) I am using http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemsecuritycryptographyrsacryptoserviceproviderclasstopic.asp with a small modification t...

convert byte[] to String and string to byte[] note encoding and decoding required....
hi all,        As the subject, can I have solution ofr the same.......  e'i Convert byte[] into string and strting into byte[] , can i have teh sample page.        Thanks & Regards,Murthy.          System.Text.Encoding.Unicode.GetString(ByteArray);//Byte Array to String             System.Text.Encoding.Unicode.GetBytes(String);//String to Byte ArrayWe All move to our original place.Don't forget.Imran Baloch thanks for...

string to byte array
Hi all, I'm currently building a small app which uses 3DES encryption, it works all nicely, but would like to do a bit a fix upcurrently the code behind has the code as followDim key As Byte() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22.2, 23, 24}and the web.config is as follows    <appSettings>    <add key="key" value="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22.2, 23, 24"/>    </appSettings> I am trying to call the values {1, 2 ,...

How do I convert string to a byte array?
[see also http://forums.sybase.com/cgi-bin/webnews.cgi?cmd=item-232695&group=sybase.public.powerbuilder.general] Working with an old OLE object for TCP comm, and the unicode vs ANSI charset change at PB 10 seems to be causing issues. BUT! the old object avoids "'wide' to ANSI" conversion and just sends what it's handed if it's handed a BYTE Array. However, getting there from a string seems to involve conversion to and parsing from a Blob, something that I'm fumbling. Some help on this conversion process would be appreciated. Convert the string to ...

String and string?
Hi guys, I was wondering the difference between small letter string type and a capital letter String type. Does anyone know about this? Highly appreciate for your answers! Thankz! The "proper" version is String, as it references the System.String class of the .NET Framework Class Library. The ability to use string is provided by C#, where it is an alias to String. Similarly, the "proper" version of an integer is Int32, as it references System.Int32.  The ability to use int is provided by C#, and the ability to use Integer is provided by VB.NET, and both int and Integer are aliases...

string() = string()
this code does not work (not instance of object) Dim Items(), Other() As String Items = New String() {"A","B","C"} Other = New String() {} Other = Items how can I get all the values ? angiras Hi, If I understand your requirement correctly, this should do it Dim Items() As String = {"A", "B", "C"} Dim Other(Items.Length - 1) As String Items.CopyTo(Other, 0) To more closely match you code above, but this will be less efficient Dim Items(), Other() As String ...

string to string[]
Hi, I've got this code : string[] Params; string SQL = "SELECT * FROM T_MANAGEMENT_PAGES"; SqlCommand myCommand = new SqlCommand(SQL, myConnection); myConnection.Open(); SqlDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { Params_Type = myReader.GetValue(0).ToString(); } } catch { } finally { } myReader.Close(); My problem is to obtain Params_Type. But each time, it says : "impossible to convert '[object]' in 'string[]' &quo...

String and String[]
What will be the advantage of using myString: String[10] over myString: String Man wrote: > What will be the advantage of using > myString: String[10] > over > myString: String "String[10]" is a fixed-length, statically allocated, Ansi-based ShortString. "String" is a dynamic-length, dynamically allocated, reference counted, Ansi-based or Unicode-based (depening on Delphi version) Long string. Unless you absolutely need the static, fixed length nature of ShortString, such as in records that interact with external systems, you should stay ...

string and string[]
hello, whats the difference here between string and string[] thanks "string" denotes an item of type String "string[]" denotes an array of type String itemsThanks, EdMicrosoft MVP - ASP/ASP.NET Gracia mon ami...

How to convert a String to a byte array? [Edit]
Hi, I want to send a string (UnicodeString typed variable) over the serial port. I have to convert the string to a byte array, which I can write to the serial port. The project options _TCHAR maps to wchar_t. Thus, how to convert a String to a byte array in C++ Builder 2010? On Microsoft Developer Network I have found: Byte unicodeBytes[] = unicode -> GetBytes(unicodeString); You can investigate it your self here: http://msdn.microsoft.com/en-us/library/system.text.encoding.convert%28VS.71%29.aspx Please do not hesitate to answer or comment this issue. All help is appreci...

Problems converting a byte array to string
Hello,i need some help on this one, i have a byte array with some information i get from an UDP serverhere is an example of what my code looks like Dim b() As Byte = {0, 179, 68, 252, 255, 128, 234, 244} Dim s As String = System.Text.Encoding.Default.GetString(b) Debug.WriteLine(s) Now if notice the first byte is 0, when this happens my result string will be nothingAny ideas on how to fix this?Thank you   I notice you're using encoding Default... 0 is often a string terminator, which could be your issue. Maybe try some of the other encodings until you find one that fi...

compilation error-- value of string cannot be converted to 1-dimensional array of string
For j = 0 To aroles.Items.Count - 1 If aroles.Items(j).Selected = True Then If Not Roles.IsUserInRole(username.ToString, aroles.SelectedValue) Then Roles.AddUsersToRole(username.ToString, aroles.SelectedValue) <-------  Error occurs here...- ' test3.Text = aroles.SelectedValue(j) End If End If Next Hey can anyone help me with this thanx heaps Mrugesh     Use the method: AddUserToRole instead of the one that adds "Users" to the role. The method that add "users" want an array of usernames, but you only provide a single string with one ...

Web resources about - How to append string to Response.OutputStream after string converted to byte array - asp.net.handlers-modules


Stack Overflow
Stack Exchange log in - careers - chat - meta - about - faq Questions Tags Users Badges Unanswered Ask Question Top Questions interesting 325 ...

JavaServer Pages - Wikipedia, the free encyclopedia
JSP is similar to PHP , but it uses the Java programming language . To deploy and run JavaServer Pages, a compatible web server with a servlet ...

Android Developers Blog
Posted by Alex Klyubin, Android Security Engineer The Android security team has been investigating the root cause of the compromise of a bitcoin ...

Some SecureRandom Thoughts
Posted by Alex Klyubin, Android Security Engineer The Android security team has been investigating the root cause of the compromise of a bitcoin ...

Android Developers Blog
Posted by Ian Lake , Developer Advocate Today, we’re excited to give you new tools to build better apps with the rollout of Google Play services ...

Better Integration of Jpype and Log4J
We’ve been using JPype at GEM to integrate some existing legacy Java libraries with the new Python code in OpenQuake. Until today, one of the ...

Java Developer Kit (JDK) Search Engine
Java Developer Kit (JDK) Search Engine

Basic4android (Basic for Android) - Android programming with Gui designer
Basic4android (Basic for Android) is a simple and powerful development environment for developers of Android applications.

Some SecureRandom Thoughts
Posted by Alex Klyubin, Android Security Engineer The Android security team has been investigating the root cause of the compromise of a bitcoin ...

Resources last updated: 12/4/2015 9:37:33 AM