C#生成單頁(yè)靜態(tài)頁(yè)簡(jiǎn)單實(shí)例
更新時(shí)間:2014年10月10日 09:36:04 投稿:shichen2014
這篇文章主要介紹了C#生成單頁(yè)靜態(tài)頁(yè)簡(jiǎn)單實(shí)例,是一個(gè)非常實(shí)用的技巧,需要的朋友可以參考下
本文實(shí)例講述了C#生成單頁(yè)靜態(tài)頁(yè)簡(jiǎn)單實(shí)現(xiàn)方法。分享給大家供大家參考。具體方法如下:
復(fù)制代碼 代碼如下:
protected void BtGroup_ServerClick(object sender, EventArgs e)
{
//產(chǎn)業(yè)群首頁(yè)
string tempGroupData = GetHttpData(" using (StreamWriter sw = new StreamWriter(this.Request.PhysicalApplicationPath + "Group\\Index.html", false, System.Text.Encoding.GetEncoding("utf-8")))
{
sw.Write(tempGroupData);
sw.Flush();
}
}
public string GetHttpData(string sUrl)
{
string sRslt = null;
WebResponse oWebRps = null;
WebRequest oWebRqst = WebRequest.Create(sUrl);
oWebRqst.Timeout = 50000;
try
{
oWebRps = oWebRqst.GetResponse();
}
finally
{
if (oWebRps != null)
{
StreamReader oStreamRd = new StreamReader(oWebRps.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
sRslt = oStreamRd.ReadToEnd();
oStreamRd.Close();
oWebRps.Close();
}
}
return sRslt;
}
{
//產(chǎn)業(yè)群首頁(yè)
string tempGroupData = GetHttpData(" using (StreamWriter sw = new StreamWriter(this.Request.PhysicalApplicationPath + "Group\\Index.html", false, System.Text.Encoding.GetEncoding("utf-8")))
{
sw.Write(tempGroupData);
sw.Flush();
}
}
public string GetHttpData(string sUrl)
{
string sRslt = null;
WebResponse oWebRps = null;
WebRequest oWebRqst = WebRequest.Create(sUrl);
oWebRqst.Timeout = 50000;
try
{
oWebRps = oWebRqst.GetResponse();
}
finally
{
if (oWebRps != null)
{
StreamReader oStreamRd = new StreamReader(oWebRps.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
sRslt = oStreamRd.ReadToEnd();
oStreamRd.Close();
oWebRps.Close();
}
}
return sRslt;
}
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C# 系統(tǒng)熱鍵注冊(cè)實(shí)現(xiàn)代碼
簡(jiǎn)單點(diǎn)說(shuō)就是為程序制定快捷鍵勒。。很多軟件都帶熱鍵功能的,通過(guò)以下方式可以實(shí)現(xiàn)2個(gè)鍵或3個(gè)鍵的快捷鍵,相當(dāng)之使用,具體實(shí)現(xiàn)方法看后文吧。2009-02-02C#實(shí)現(xiàn)分治算法求解股票問(wèn)題
本文主要介紹了C#實(shí)現(xiàn)分治算法求解股票問(wèn)題,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-04-04C#如何提取經(jīng)緯度文件中的經(jīng)緯度數(shù)據(jù)
近期開(kāi)發(fā)時(shí)需要獲取當(dāng)前的經(jīng)緯度坐標(biāo),下面這篇文章主要給大家介紹了關(guān)于C#如何提取經(jīng)緯度文件中經(jīng)緯度數(shù)據(jù)的相關(guān)資料,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下2022-08-08C#實(shí)現(xiàn)鼠標(biāo)左右鍵切換效果
這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)鼠標(biāo)左右鍵切換功能,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下2022-12-12C#上位機(jī)與三菱PLC通訊的實(shí)現(xiàn)步驟(圖文)
這篇文章主要介紹了C#上位機(jī)與三菱PLC通訊的實(shí)現(xiàn)步驟(圖文),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02