所以该页面显示的是用word显示出来的登陆页面的html页面。这句话理解了半天还是没明白呀

解决方案 »

  1.   

    因为我存的是word文件,显示的时候应该也是word文件,结果他显示却是用word显示出来的登陆页面的html文件,没有显示原来word文件的内容。
      

  2.   

    因为你选择了Forms验证,改用Windows验证
    <authentication mode="Windows" />
      

  3.   

    存成html的行么?
      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
      

  4.   

    虫子,我的整个系统的身份验证都是采用Forms,有没有其他办法能够不更改验证模式,也能解决我的问题
      

  5.   

    那就在
    dr=SelCommand.ExecuteReader();
    if(dr.Read())
    {
        Response.Clear();
        Response.AddHeader("Content-Type",dr["ContentType"].ToString());
        Response.BinaryWrite((byte[])dr["ExcursusData"]);
    }
    dr.Close();的页面作权限验证,
      

  6.   

    怎么做呀,以前的页面权限是在webconfig里写的,这个怎么写呀?