Solved

Equivalent of PHP Function GZDeflate in C#

Posted on 2012-04-04
3
957 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

14 Experts available now in Live!

Get 1:1 Help Now