所以该页面显示的是用word显示出来的登陆页面的html页面。这句话理解了半天还是没明白呀
解决方案 »
- c#程序如何发布
- C# 中如何获取指定目录下的所有文件名???!!!
- 多个input时,怎么统一设置它的事件
- winform中的层次关系
- IIS设置问题(用Localhost登陆完全没问题,而IP???)
- 项目之间调用
- #####制作个安装包(或建一个安装部署解决方案)就可以在没有.net framework框架的计算机上运行C#的程序吗。#…#…#…
- 大家来说说:程序员一般做多少年后就不适合做了??
- using Microsoft.Web.UI.WebControls;这个引用我为社么不能用?
- 怎样使插入文本时能使RichTextBox滚动条自动向下滚动
- 关于.net打包问题。
- ADO.NET中连接ODBC数据源的问题,急!!
<authentication mode="Windows" />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If txtUpfile.PostedFile.ContentLength > (1024 * 500) Then
Response.Write("<script>alert('请不要上传大于500KB的文件。')</script>")
Return
End If
If Right(txtUpfile.PostedFile.FileName, 3) <> "htm" And Right(txtUpfile.PostedFile.FileName, 4) <> "html" And Right(txtUpfile.PostedFile.FileName, 3) <> "HTM" And Right(txtUpfile.PostedFile.FileName, 4) <> "HTML" Then
Response.Write("<script>alert('请上传文件格式为htm或html的文件')</script>")
Return
End If
If txtBt.Text = "" Then
Response.Write("<script>alert('请填写标题')</script>")
Return
End If
If txtNr.Text = "" Then
Response.Write("<script>alert('请粘贴文件内容')</script>")
Return
End If
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password;Data Source=......;Mode=ReadWrite|Share Deny None;Persist Security Info=False")
Dim comm As New OleDb.OleDbCommand
comm.Connection = conn
comm.CommandText = "insert into fg (dw,wh,bt,lr,rq,dmfw) values ('" & txtDw.Text & "','" & txtWh.Text & "','" & txtBt.Text & "','" & txtNr.Text & "','" & dtRq.SelectedDate.Date & "','4')"
conn.Open()
comm.ExecuteNonQuery()
'conn.Close() comm.CommandText = "UPDATE fg SET path = 'zy'+trim(str([id])) WHERE dmfw='4'"
comm.ExecuteNonQuery()
comm.CommandText = "select max(id) as id from fg "
comm.ExecuteNonQuery()
Dim rd As OleDb.OleDbDataReader
rd = comm.ExecuteReader
rd.Read()
txtUpfile.PostedFile.SaveAs(Server.MapPath("..\fgwj\") & "zy" & rd("id") & ".html")
rd.Close()
conn.Close() conn.Open()
comm.ExecuteNonQuery()
Response.Write("<script>alert('文档添加完成')</script>") txtDw.Text = ""
txtBt.Text = ""
txtWh.Text = ""
txtNr.Text = ""
conn.Dispose()
comm.Dispose()
End Sub
以前做的一个东西的上传html文件的部分,你自己看着改一下。
读取的时候
Dim sr As StreamReader = New StreamReader(Server.MapPath("fgwj\") & DataGrid1.SelectedItem.Cells(0).Text & ".html", Encoding.Default)
'lblNr.Text = sr.ReadToEnd
dr=SelCommand.ExecuteReader();
if(dr.Read())
{
Response.Clear();
Response.AddHeader("Content-Type",dr["ContentType"].ToString());
Response.BinaryWrite((byte[])dr["ExcursusData"]);
}
dr.Close();的页面作权限验证,