Solved

Equivalent of PHP Function GZDeflate in C#

Posted on 2012-04-04
3
1,007 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

762 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