c# webbrowser控件 如何将打开的网页自动保存为本地html文件?
c#如何将在webbrowser中打开的网页自动保存为本地html文件?最好附带一段代码,谢谢...
c# 如何将在webbrowser中打开的网页自动保存为本地html文件?
最好附带一段代码,谢谢 展开
最好附带一段代码,谢谢 展开
展开全部
我的完全可以,请黏贴如下代码看看呢?(我用maxthon最新版本的):
以下是aspx代码:
<%@
page
language="c#"
autoeventwireup="true"
codebehind="webform7.aspx.cs"
inherits="testwebdemo.webform7"
enableviewstate="false"
%>
<!doctype
html
public
"-//w3c//dtd
xhtml
1.0
transitional//en"
"
http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html
xmlns="
http://www.w3.org/1999/xhtml">
<head
runat="server">
<title>viewstate
demo</title>
</head>
<body>
<form
id="form1"
runat="server"
method=get>
<div>
<input
type=textbox
value='
<%=configurationmanager.appsettings["constr"]%>'
style='width:734px'
/>
</div>
</form>
</body>
</html>
以下是配置文件:
<configuration>
<appsettings>
<add
key="constr"
value="server=server2;database=test;uid=*****;pwd=*****"/>
</appsettings>
<connectionstrings>
<add
name="northwindconnectionstring"
connectionstring="data
source=.\sqlexpress;initial
catalog=northwind;integrated
security=true"
providername="system.data.sqlclient"/>
</connectionstrings>
....
以下是aspx代码:
<%@
page
language="c#"
autoeventwireup="true"
codebehind="webform7.aspx.cs"
inherits="testwebdemo.webform7"
enableviewstate="false"
%>
<!doctype
html
public
"-//w3c//dtd
xhtml
1.0
transitional//en"
"
http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html
xmlns="
http://www.w3.org/1999/xhtml">
<head
runat="server">
<title>viewstate
demo</title>
</head>
<body>
<form
id="form1"
runat="server"
method=get>
<div>
<input
type=textbox
value='
<%=configurationmanager.appsettings["constr"]%>'
style='width:734px'
/>
</div>
</form>
</body>
</html>
以下是配置文件:
<configuration>
<appsettings>
<add
key="constr"
value="server=server2;database=test;uid=*****;pwd=*****"/>
</appsettings>
<connectionstrings>
<add
name="northwindconnectionstring"
connectionstring="data
source=.\sqlexpress;initial
catalog=northwind;integrated
security=true"
providername="system.data.sqlclient"/>
</connectionstrings>
....
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
先读取页面内容,然后用IO写入HTML
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create("http://www.crazycoder.cn/");
wReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50215; " + Guid.NewGuid().ToString() + ")";
HttpWebResponse wResp = wReq.GetResponse() as HttpWebResponse;
wReq.AllowAutoRedirect = true;
// 获取输入流
System.IO.Stream respStream = wResp.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(respStream, encode);
string content = reader.ReadToEnd();
reader.Close();
reader.Dispose();
respStream.Close();
respStream.Dispose();
wResp.Close();
wReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50215; " + Guid.NewGuid().ToString() + ")";
HttpWebResponse wResp = wReq.GetResponse() as HttpWebResponse;
wReq.AllowAutoRedirect = true;
// 获取输入流
System.IO.Stream respStream = wResp.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(respStream, encode);
string content = reader.ReadToEnd();
reader.Close();
reader.Dispose();
respStream.Close();
respStream.Dispose();
wResp.Close();
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个问题好像不太好弄
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询