Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

javascript - unzip Api Response ZipFile c# mvc

I got application/x-zip-compressed as Content-Type in the api response How i get the data in this Zip file to a string in c# code or How i download and read its data

Here is my Request format

public string SendRequest(string Url) { string xmlRequestData2 = Url;

        string resp = "";
        WebResponse response = null;
        try
        {
            try
            {
                WebRequest request = WebRequest.Create(xmlRequestData2);
                request.Method = "GET";
                request.Headers["Api-Key"] = "******";
                request.Headers["Authorization"] = "*************";
                request.ContentType = "application/json";
                request.Credentials = new NetworkCredential("aaa", "*************");
                response = request.GetResponse();
                Stream stream = response.GetResponseStream();
                StreamReader reader = new StreamReader(stream);
                resp = reader.ReadToEnd();
                reader.Close();
                stream.Close();
            }
            catch (WebException webException)
            {
                try
                {
                    WebResponse responses = webException.Response;
                    Stream streams = responses.GetResponseStream();
                    String responseMessage = new StreamReader(streams).ReadToEnd();
                    
                }
                catch (Exception gen)
                {
                    
                }
            }
            catch (Exception exception)
            {
               
            }
        }
        finally
        {
            try
            {
                response.Close();
            }
            catch
            {
            }
        }
        return resp;
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.7k users

...