Solved

Equivalent of PHP Function GZDeflate in C#

Posted on 2012-04-04
3
1,042 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

617 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