Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1104
  • Last Modified:

Equivalent of PHP Function GZDeflate in C#

Hello Experts,

To communicate SAML messages to an Authentication Server, I have PHP code that generates a SAML message, then compresses it using gzdeflate().

I would like to translate this to ASP.Net (C#) but I can't find an equivalent for gzdeflate().  Who can help me?
0
Zenturio
Asked:
Zenturio
  • 2
1 Solution
 
brendanmeyerCommented:
0
 
lojk.Net and Infrastructure ConsultantCommented:
Rather than requiring another library added to your project just do it in native .net

http://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream.aspx (note that they do also discuss the GZDeflate Method here too)

edit: for clarity of my link above here is the actual MSDN article for GzipStream
http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx

This example above shows you how to use it for a filestream but i have previously used it in conjuction with a memorystream object to compress text (and binary/image) that had been converted to a byte array that was then enc64 and transmitted down a tcp channel.

Here is a page that contains an example of compressing text in exactly this manner - without 3rd party libraries.

http://www.dotnetperls.com/compress
0
 
lojk.Net and Infrastructure ConsultantCommented:
Another point to mention here is that when including/referencing/linking to 3rd party libraries especially ones that are licensed under any variant of the GPL you could face problems with licensing/royalties or just be obliged to add statements of use in prominent places in your app that may be less than desirable.

The ziplib project mentioned in the first reply actually has an exception made on its page to permit you to use it in any manner you like but you should be very careful using any code or library that is protected by GPL if you intend to use it commercially or make profit from your project/product.

Here is a great start point to understanding the protections (from commercial explotiation) that the GPL provides to the Free Software community and the obligations in return that you are expected should you link to GPL code.

http://en.wikipedia.org/wiki/GNU_General_Public_License
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now