This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ZipArchive archive = new ZipArchive(model.File.InputStream, ZipArchiveMode.Read)) | |
{ | |
//archive.ExtractToDirectory(Statics.TemplatesPath); | |
foreach (ZipArchiveEntry entry in archive.Entries) | |
{ | |
string fullPath = Path.Combine(Statics.TemplatesPath, entry.FullName); | |
if (string.IsNullOrEmpty(entry.Name)) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var fileStream = new FileStream(@"C:\Temp\test.zip", FileMode.Create)) | |
{ | |
memoryStream.Seek(0, SeekOrigin.Begin); | |
memoryStream.CopyTo(fileStream); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileResult : IHttpActionResult | |
{ | |
private readonly byte[] _fileBinary; | |
private readonly string _contentType; | |
private string _fileName; | |
public FileResult(byte[] fileBinary, string contentType, string fileName) | |
{ | |
this._fileBinary = fileBinary; | |
this._contentType = contentType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string url = "http://url.com/*.wsdl"; | |
using (var client = new WebClient()) | |
{ | |
var data = System.IO.File.ReadAllText(HostingEnvironment.MapPath(@"~/App_Data/request.xml")); | |
client.Headers.Add("Content-Type", "text/xml;charset=utf-8"); | |
client.Encoding = Encoding.GetEncoding("ISO-8859-1"); | |
client.Credentials = new NetworkCredential("username", "pass"); | |
client.Headers.Add("SOAPAction", "\"http://url.com/wsdl?action\""); |