Solved

Equivalent of PHP Function GZDeflate in C#

Posted on 2012-04-04
3
965 Views
Last Modified: 2012-04-05
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
Comment
Question by:Zenturio
  • 2
3 Comments
 
LVL 14

Expert Comment

by:brendanmeyer
ID: 37805016
0
 
LVL 9

Accepted Solution

by:
lojk earned 250 total points
ID: 37806276
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
 
LVL 9

Expert Comment

by:lojk
ID: 37810203
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now