NotMyRealName221
Programmer
Hello,
thanks for taking a look at my problem.
I have a SoapExtension that needs to access the soap message for logging. I'm trying to switch that logging from flat file to database.
Everything has been working fine with the flat file all along. The basic process is this:
Copy the existing message stream.
Write it out to a file
Copy the stream back to the message stream (or else it wont be available when other steps need it)
I'm trying to change that where it writes to the DB instead so the simplest idea seemed to be outputing the stream as a string and using that in the SQL query (parameterized of course)
No matter what I do with that stream once I've output it as a string it's closed, I can't reposition, seek or anything that will make that stream usable again.
Here is my code to convert from Stream to String:
With the filelogging code it simply resets the Pointer to 0 when done and everything works fine.
If I try to reset the Pointer to 0 after this function it gives me the Stream Closed error.
Any idea how to get the string from the stream without busting the stream?
Thanks
thanks for taking a look at my problem.
I have a SoapExtension that needs to access the soap message for logging. I'm trying to switch that logging from flat file to database.
Everything has been working fine with the flat file all along. The basic process is this:
Copy the existing message stream.
Write it out to a file
Copy the stream back to the message stream (or else it wont be available when other steps need it)
I'm trying to change that where it writes to the DB instead so the simplest idea seemed to be outputing the stream as a string and using that in the SQL query (parameterized of course)
No matter what I do with that stream once I've output it as a string it's closed, I can't reposition, seek or anything that will make that stream usable again.
Here is my code to convert from Stream to String:
Code:
public string getStringFromStream(Stream stream)
{
using (StreamReader reader = new StreamReader(stream))
{
return = reader.ReadToEnd();
}
}
With the filelogging code it simply resets the Pointer to 0 when done and everything works fine.
If I try to reset the Pointer to 0 after this function it gives me the Stream Closed error.
Any idea how to get the string from the stream without busting the stream?
Thanks