블로그 이미지
baragi76

카테고리

분류 전체보기 (115)
생활 (10)
My Story (34)
My Album (1)
HomePage (0)
Hobbies (21)
Develop (42)
Utility (1)
Project (6)
Statistics Graph
Total231,232
Today16
Yesterday29

공지사항

달력

« » 2019.7
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Json 데이터로 구성되어있는 데이터를 NameValueCollection으로 변환하여 참조하기 위하여 사용...
참조 예제일 뿐... ^^
기록해 두지 않으면 잊어 먹어싸서...

# 참조
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.Script.Serialization;


public NameValueCollection FromJsonData(string jsonData)
{
    JavaScriptSerializer jsData = new JavaScriptSerializer();
    Dictionary<string, string> dictionary = jsData.Deserialize<Dictionary<string, string>>(jsonData);
    NameValueCollection jsonCollection = new NameValueCollection();
    foreach (string key in dictionary.Keys)
    {
        string value = dictionary[key];
        jsonCollection[key] = value;
    }

    return jsonCollection;
}

Posted by baragi76

string destFile = strTempDir + strFileName + ".docx";
FileStream sm1 = File.OpenRead(destFile);

Response.ClearHeaders();
Response.ClearContent();
Response.Clear();

Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";

Response.AddHeader("Content-disposition", "attachment;filename=" + "OKOK.docx;");
Response.AddHeader("Content-Length", sm1.Length.ToString());

Response.WriteFile(destFile);
Response.Flush();
Response.Close();

sm1.Close();

try
{
 if (File.Exists(destFile))
 {
  File.Delete(destFile);
 }
}
catch (Exception ex)
{
}

Posted by baragi76
TAG ASP.NET, Web