viktor999
asked on
uploading images files problem
I'm trying to upload images files to a certain directory but I'm getting this error message. When I writeklick the images image and select properties I can't reach the security tab (it does not appear).
What can I do to fix the problem? Thank you
Here is the error message I'm getting:
Access to the path "c:\inetpub\wwwroot\Maklar na_5\bilde r\31076036 .jpeg" is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessE xception: Access to the path "c:\inetpub\wwwroot\Maklar na_5\bilde r\31076036 .jpeg" is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 86:
Line 87: '
Line 88: myFile.PostedFile.SaveAs(M apPath("bi lder/") & strFileNameOnly)
Line 89:
Line 90: Dim intFileNameLength1 As Integer
Source File: C:\Inetpub\wwwroot\Maklarn a_5\admin_ ny_objekt. aspx.vb Line: 88
Stack Trace:
[UnauthorizedAccessExcepti on: Access to the path "c:\inetpub\wwwroot\Maklar na_5\bilde r\31076036 .jpeg" is denied.]
System.IO.__Error.WinIOErr or(Int32 errorCode, String str) +393
System.IO.FileStream..ctor (String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor (String path, FileMode mode) +52
System.Web.HttpPostedFile. SaveAs(Str ing filename) +48
Maklarna_5.admin_ny_objekt .Submit(Ob ject obj, EventArgs e) in C:\Inetpub\wwwroot\Maklarn a_5\admin_ ny_objekt. aspx.vb:88
System.Web.UI.HtmlControls .HtmlInput Button.OnS erverClick (EventArgs e) +108
System.Web.UI.HtmlControls .HtmlInput Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument) +57
System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData) +138
System.Web.UI.Page.Process RequestMai n() +1277
Here is my code behind code:
Imports System.Data.Odbc
Imports System.Configuration
Public Class admin_ny_objekt
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblMessage As System.Web.UI.WebControls. Label
Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator2 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator3 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator4 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator5 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator6 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator7 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator8 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator9 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator10 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator11 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator12 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator13 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator14 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator15 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator16 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator24 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator18 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator25 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator26 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator27 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator28 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator29 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents RequiredFieldValidator30 As System.Web.UI.WebControls. RequiredFi eldValidat or
Protected WithEvents Button1 As System.Web.UI.HtmlControls .HtmlInput Button
Protected WithEvents tbLan As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbAdress As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbKategori As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbBoyta As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbRum As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbAvgift As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbPris As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents tbFastighetsbeteckning As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents taBeskrivning As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taPlanlosning As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taByggnadssatt As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taPlanbestammelser As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taTomtbeskrivning As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taGarage As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taEkonomi As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents taOvrigt As System.Web.UI.HtmlControls .HtmlTextA rea
Protected WithEvents myFile As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents myFile1 As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents myFile2 As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents myFile3 As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents myFile4 As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents myFile5 As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents myFile6 As System.Web.UI.HtmlControls .HtmlInput File
Protected WithEvents tbKommun As System.Web.UI.HtmlControls .HtmlInput Text
Protected WithEvents Button2 As System.Web.UI.HtmlControls .HtmlInput Button
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Sub Submit(ByVal obj As Object, ByVal e As EventArgs)
'If Not (myFile.PostedFile Is Nothing) Then
If Page.IsValid Then
Dim intFileNameLength As Integer
Dim strFileNamePath As String
Dim strFileNameOnly As String
'Logic to find the FileName (excluding the path)
strFileNamePath = myFile.PostedFile.FileName
intFileNameLength = InStr(1, StrReverse(strFileNamePath ), "\")
strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)
'myFile.PostedFile.SaveAs( "c:\ASPnet \upload\" & strFileNameOnly)
myFile.PostedFile.SaveAs(M apPath("bi lder/") & strFileNameOnly)
Dim intFileNameLength1 As Integer
Dim strFileNamePath1 As String
Dim strFileNameOnly1 As String
'Logic to find the FileName (excluding the path)
strFileNamePath1 = myFile1.PostedFile.FileNam e
intFileNameLength1 = InStr(1, StrReverse(strFileNamePath 1), "\")
strFileNameOnly1 = Mid(strFileNamePath1, (Len(strFileNamePath1) - intFileNameLength1) + 2)
myFile1.PostedFile.SaveAs( MapPath("b ilder2/") & strFileNameOnly1)
Dim intFileNameLength2 As Integer
Dim strFileNamePath2 As String
Dim strFileNameOnly2 As String
'Logic to find the FileName (excluding the path)
strFileNamePath2 = myFile2.PostedFile.FileNam e
intFileNameLength2 = InStr(1, StrReverse(strFileNamePath 2), "\")
strFileNameOnly2 = Mid(strFileNamePath2, (Len(strFileNamePath2) - intFileNameLength2) + 2)
myFile2.PostedFile.SaveAs( MapPath("b ilder2/") & strFileNameOnly2)
Dim intFileNameLength3 As Integer
Dim strFileNamePath3 As String
Dim strFileNameOnly3 As String
'Logic to find the FileName (excluding the path)
strFileNamePath3 = myFile3.PostedFile.FileNam e
intFileNameLength3 = InStr(1, StrReverse(strFileNamePath 3), "\")
strFileNameOnly3 = Mid(strFileNamePath3, (Len(strFileNamePath3) - intFileNameLength3) + 2)
myFile3.PostedFile.SaveAs( MapPath("b ilder2/") & strFileNameOnly3)
Dim intFileNameLength4 As Integer
Dim strFileNamePath4 As String
Dim strFileNameOnly4 As String
'Logic to find the FileName (excluding the path)
strFileNamePath4 = myFile4.PostedFile.FileNam e
intFileNameLength4 = InStr(1, StrReverse(strFileNamePath 4), "\")
strFileNameOnly4 = Mid(strFileNamePath4, (Len(strFileNamePath4) - intFileNameLength4) + 2)
myFile4.PostedFile.SaveAs( MapPath("b ilder2/") & strFileNameOnly4)
Dim intFileNameLength5 As Integer
Dim strFileNamePath5 As String
Dim strFileNameOnly5 As String
'Logic to find the FileName (excluding the path)
strFileNamePath5 = myFile5.PostedFile.FileNam e
intFileNameLength5 = InStr(1, StrReverse(strFileNamePath 5), "\")
strFileNameOnly5 = Mid(strFileNamePath5, (Len(strFileNamePath5) - intFileNameLength5) + 2)
myFile5.PostedFile.SaveAs( MapPath("b ilder2/") & strFileNameOnly5)
Dim intFileNameLength6 As Integer
Dim strFileNamePath6 As String
Dim strFileNameOnly6 As String
'Logic to find the FileName (excluding the path)
strFileNamePath6 = myFile6.PostedFile.FileNam e
intFileNameLength6 = InStr(1, StrReverse(strFileNamePath 6), "\")
strFileNameOnly6 = Mid(strFileNamePath6, (Len(strFileNamePath6) - intFileNameLength6) + 2)
myFile6.PostedFile.SaveAs( MapPath("b ilder2/") & strFileNameOnly6)
Dim myConnection As OdbcConnection = New OdbcConnection(Configurati onSettings .AppSettin gs("Connec tionString "))
Dim myDataReader As OdbcDataReader
Dim myCommand As OdbcCommand = New OdbcCommand("INSERT INTO objekt ( Lan, Kommun, Adress, Kategori, Boyta, Rum, Avgift, Pris, Bild, Beskrivning, Storbild1, Storbild2, Storbild3, Storbild4, Storbild5, Storbild6 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", myConnection)
'Ställ in parametrarna till den lagrade proceduren
Dim objParam As OdbcParameter
objParam = myCommand.Parameters.Add(" Lan", OdbcType.VarChar)
objParam.Value = tbLan.Value
objParam = myCommand.Parameters.Add(" Kommun", OdbcType.VarChar)
objParam.Value = tbKommun.Value
objParam = myCommand.Parameters.Add(" Adress", OdbcType.VarChar)
objParam.Value = tbAdress.Value
objParam = myCommand.Parameters.Add(" Kategori", OdbcType.VarChar)
objParam.Value = tbKategori.Value
objParam = myCommand.Parameters.Add(" Boyta", CInt(tbBoyta.Value))
'objParam.Value = tbBoyta.Value
objParam = myCommand.Parameters.Add(" Rum", CInt(tbRum.Value))
'objParam.Value = tbRum.Value
objParam = myCommand.Parameters.Add(" Avgift", CInt(tbAvgift.Value))
'objParam.Value = tbAvgift.Value
objParam = myCommand.Parameters.Add(" Pris", OdbcType.VarChar)
'objParam.Value = tbPris.Value
objParam = myCommand.Parameters.Add(" Bild", strFileNameOnly1)
'objParam.Value = strFileNameOnly1
objParam = myCommand.Parameters.Add(" Beskrivnin g", OdbcType.VarChar)
objParam.Value = taBeskrivning.Value
objParam = myCommand.Parameters.Add(" Storbild1" , OdbcType.VarChar)
objParam.Value = strFileNameOnly1
objParam = myCommand.Parameters.Add(" Storbild2" , OdbcType.VarChar)
objParam.Value = strFileNameOnly2
objParam = myCommand.Parameters.Add(" Storbild3" , OdbcType.VarChar)
objParam.Value = strFileNameOnly3
objParam = myCommand.Parameters.Add(" Storbild4" , OdbcType.VarChar)
objParam.Value = strFileNameOnly4
objParam = myCommand.Parameters.Add(" Storbild5" , OdbcType.VarChar)
objParam.Value = strFileNameOnly5
objParam = myCommand.Parameters.Add(" Storbild6" , OdbcType.VarChar)
objParam.Value = strFileNameOnly6
Try
myCommand.Connection.Open( )
myCommand.ExecuteNonQuery( )
myCommand.Connection.Close ()
Catch ex As OdbcException
lblMessage.Text = ex.Message
End Try
'nytt
Dim myConnection2 As OdbcConnection = New OdbcConnection(Configurati onSettings .AppSettin gs("Connec tionString "))
Dim strTextFastig As String = tbFastighetsbeteckning.Val ue
'erstter Retur-slag med <br> tag
strTextFastig = Replace(strTextFastig, vbCrLf, "<br />")
Dim strTextBesk As String = taBeskrivning.Value
strTextBesk = Replace(strTextBesk, vbCrLf, "<br />")
Dim strTextPlanl As String = taPlanlosning.Value
strTextPlanl = Replace(strTextPlanl, vbCrLf, "<br />")
Dim strTextBygg As String = taByggnadssatt.Value
strTextBygg = Replace(strTextBygg, vbCrLf, "<br />")
Dim strTextPlanb As String = taPlanbestammelser.Value
strTextPlanb = Replace(strTextPlanb, vbCrLf, "<br />")
Dim strTextTomt As String = taTomtbeskrivning.Value
strTextTomt = Replace(strTextTomt, vbCrLf, "<br />")
Dim strTextGarage As String = taGarage.Value
strTextGarage = Replace(strTextGarage, vbCrLf, "<br />")
Dim strTextEkonomi As String = taEkonomi.Value
strTextEkonomi = Replace(strTextEkonomi, vbCrLf, "<br />")
Dim strTextOvrigt As String = taOvrigt.Value
strTextOvrigt = Replace(strTextOvrigt, vbCrLf, "<br />")
Dim myDataReader2 As OdbcDataReader
Dim myCommand2 As OdbcCommand = New OdbcCommand("INSERT INTO detaljer ( Fastighetsbeteckning, Beskrivning, Planlosning, Byggnadssatt, Planbestammelser, Tomtbeskrivning, Garage, Ekonomi, Ovrit ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", myConnection2)
'Ställ in parametrarna till den lagrade proceduren
Dim objParam2 As OdbcParameter
objParam2 = myCommand2.Parameters.Add( "Fastighet sbetecknin g", OdbcType.VarChar)
objParam2.Value = strTextFastig
objParam2 = myCommand2.Parameters.Add( "Beskrivni ng", OdbcType.VarChar)
objParam2.Value = strTextBesk
objParam2 = myCommand2.Parameters.Add( "Planlosni ng", OdbcType.VarChar)
objParam2.Value = strTextPlanl
objParam2 = myCommand2.Parameters.Add( "Byggnadss att", OdbcType.VarChar)
objParam2.Value = strTextBygg
objParam2 = myCommand2.Parameters.Add( "Planbesta mmelser", OdbcType.VarChar)
objParam2.Value = strTextPlanb
objParam2 = myCommand2.Parameters.Add( "Tomtbeskr ivning", OdbcType.VarChar)
objParam2.Value = strTextTomt
objParam2 = myCommand2.Parameters.Add( "Garage", OdbcType.VarChar)
objParam2.Value = strTextGarage
objParam2 = myCommand2.Parameters.Add( "Ekonomi", OdbcType.VarChar)
objParam2.Value = strTextEkonomi
objParam2 = myCommand2.Parameters.Add( "Ovrigt", OdbcType.VarChar)
objParam2.Value = strTextOvrigt
'objParam = myCommand.Parameters.Add(" @Bild1", odbcType.VarChar)
'objParam.Value = taBild1.value
Try
myCommand2.Connection.Open ()
myCommand2.ExecuteNonQuery ()
myCommand2.Connection.Clos e()
Catch ex As OdbcException
lblMessage.Text = ex.Message
End Try
lblMessage.Text = "Bilderna och informationen har sparats i databasen."
Else
lblMessage.Text = "problem med att överföra informationen till databasen"
End If
End Sub
End Class
What can I do to fix the problem? Thank you
Here is the error message I'm getting:
Access to the path "c:\inetpub\wwwroot\Maklar
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessE
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 86:
Line 87: '
Line 88: myFile.PostedFile.SaveAs(M
Line 89:
Line 90: Dim intFileNameLength1 As Integer
Source File: C:\Inetpub\wwwroot\Maklarn
Stack Trace:
[UnauthorizedAccessExcepti
System.IO.__Error.WinIOErr
System.IO.FileStream..ctor
System.IO.FileStream..ctor
System.Web.HttpPostedFile.
Maklarna_5.admin_ny_objekt
System.Web.UI.HtmlControls
System.Web.UI.HtmlControls
System.Web.UI.Page.RaisePo
System.Web.UI.Page.RaisePo
System.Web.UI.Page.Process
Here is my code behind code:
Imports System.Data.Odbc
Imports System.Configuration
Public Class admin_ny_objekt
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg
End Sub
Protected WithEvents lblMessage As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator2 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator3 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator4 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator5 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator6 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator7 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator8 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator9 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator10 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator11 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator12 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator13 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator14 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator15 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator16 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator24 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator18 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator25 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator26 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator27 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator28 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator29 As System.Web.UI.WebControls.
Protected WithEvents RequiredFieldValidator30 As System.Web.UI.WebControls.
Protected WithEvents Button1 As System.Web.UI.HtmlControls
Protected WithEvents tbLan As System.Web.UI.HtmlControls
Protected WithEvents tbAdress As System.Web.UI.HtmlControls
Protected WithEvents tbKategori As System.Web.UI.HtmlControls
Protected WithEvents tbBoyta As System.Web.UI.HtmlControls
Protected WithEvents tbRum As System.Web.UI.HtmlControls
Protected WithEvents tbAvgift As System.Web.UI.HtmlControls
Protected WithEvents tbPris As System.Web.UI.HtmlControls
Protected WithEvents tbFastighetsbeteckning As System.Web.UI.HtmlControls
Protected WithEvents taBeskrivning As System.Web.UI.HtmlControls
Protected WithEvents taPlanlosning As System.Web.UI.HtmlControls
Protected WithEvents taByggnadssatt As System.Web.UI.HtmlControls
Protected WithEvents taPlanbestammelser As System.Web.UI.HtmlControls
Protected WithEvents taTomtbeskrivning As System.Web.UI.HtmlControls
Protected WithEvents taGarage As System.Web.UI.HtmlControls
Protected WithEvents taEkonomi As System.Web.UI.HtmlControls
Protected WithEvents taOvrigt As System.Web.UI.HtmlControls
Protected WithEvents myFile As System.Web.UI.HtmlControls
Protected WithEvents myFile1 As System.Web.UI.HtmlControls
Protected WithEvents myFile2 As System.Web.UI.HtmlControls
Protected WithEvents myFile3 As System.Web.UI.HtmlControls
Protected WithEvents myFile4 As System.Web.UI.HtmlControls
Protected WithEvents myFile5 As System.Web.UI.HtmlControls
Protected WithEvents myFile6 As System.Web.UI.HtmlControls
Protected WithEvents tbKommun As System.Web.UI.HtmlControls
Protected WithEvents Button2 As System.Web.UI.HtmlControls
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Sub Submit(ByVal obj As Object, ByVal e As EventArgs)
'If Not (myFile.PostedFile Is Nothing) Then
If Page.IsValid Then
Dim intFileNameLength As Integer
Dim strFileNamePath As String
Dim strFileNameOnly As String
'Logic to find the FileName (excluding the path)
strFileNamePath = myFile.PostedFile.FileName
intFileNameLength = InStr(1, StrReverse(strFileNamePath
strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)
'myFile.PostedFile.SaveAs(
myFile.PostedFile.SaveAs(M
Dim intFileNameLength1 As Integer
Dim strFileNamePath1 As String
Dim strFileNameOnly1 As String
'Logic to find the FileName (excluding the path)
strFileNamePath1 = myFile1.PostedFile.FileNam
intFileNameLength1 = InStr(1, StrReverse(strFileNamePath
strFileNameOnly1 = Mid(strFileNamePath1, (Len(strFileNamePath1) - intFileNameLength1) + 2)
myFile1.PostedFile.SaveAs(
Dim intFileNameLength2 As Integer
Dim strFileNamePath2 As String
Dim strFileNameOnly2 As String
'Logic to find the FileName (excluding the path)
strFileNamePath2 = myFile2.PostedFile.FileNam
intFileNameLength2 = InStr(1, StrReverse(strFileNamePath
strFileNameOnly2 = Mid(strFileNamePath2, (Len(strFileNamePath2) - intFileNameLength2) + 2)
myFile2.PostedFile.SaveAs(
Dim intFileNameLength3 As Integer
Dim strFileNamePath3 As String
Dim strFileNameOnly3 As String
'Logic to find the FileName (excluding the path)
strFileNamePath3 = myFile3.PostedFile.FileNam
intFileNameLength3 = InStr(1, StrReverse(strFileNamePath
strFileNameOnly3 = Mid(strFileNamePath3, (Len(strFileNamePath3) - intFileNameLength3) + 2)
myFile3.PostedFile.SaveAs(
Dim intFileNameLength4 As Integer
Dim strFileNamePath4 As String
Dim strFileNameOnly4 As String
'Logic to find the FileName (excluding the path)
strFileNamePath4 = myFile4.PostedFile.FileNam
intFileNameLength4 = InStr(1, StrReverse(strFileNamePath
strFileNameOnly4 = Mid(strFileNamePath4, (Len(strFileNamePath4) - intFileNameLength4) + 2)
myFile4.PostedFile.SaveAs(
Dim intFileNameLength5 As Integer
Dim strFileNamePath5 As String
Dim strFileNameOnly5 As String
'Logic to find the FileName (excluding the path)
strFileNamePath5 = myFile5.PostedFile.FileNam
intFileNameLength5 = InStr(1, StrReverse(strFileNamePath
strFileNameOnly5 = Mid(strFileNamePath5, (Len(strFileNamePath5) - intFileNameLength5) + 2)
myFile5.PostedFile.SaveAs(
Dim intFileNameLength6 As Integer
Dim strFileNamePath6 As String
Dim strFileNameOnly6 As String
'Logic to find the FileName (excluding the path)
strFileNamePath6 = myFile6.PostedFile.FileNam
intFileNameLength6 = InStr(1, StrReverse(strFileNamePath
strFileNameOnly6 = Mid(strFileNamePath6, (Len(strFileNamePath6) - intFileNameLength6) + 2)
myFile6.PostedFile.SaveAs(
Dim myConnection As OdbcConnection = New OdbcConnection(Configurati
Dim myDataReader As OdbcDataReader
Dim myCommand As OdbcCommand = New OdbcCommand("INSERT INTO objekt ( Lan, Kommun, Adress, Kategori, Boyta, Rum, Avgift, Pris, Bild, Beskrivning, Storbild1, Storbild2, Storbild3, Storbild4, Storbild5, Storbild6 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", myConnection)
'Ställ in parametrarna till den lagrade proceduren
Dim objParam As OdbcParameter
objParam = myCommand.Parameters.Add("
objParam.Value = tbLan.Value
objParam = myCommand.Parameters.Add("
objParam.Value = tbKommun.Value
objParam = myCommand.Parameters.Add("
objParam.Value = tbAdress.Value
objParam = myCommand.Parameters.Add("
objParam.Value = tbKategori.Value
objParam = myCommand.Parameters.Add("
'objParam.Value = tbBoyta.Value
objParam = myCommand.Parameters.Add("
'objParam.Value = tbRum.Value
objParam = myCommand.Parameters.Add("
'objParam.Value = tbAvgift.Value
objParam = myCommand.Parameters.Add("
'objParam.Value = tbPris.Value
objParam = myCommand.Parameters.Add("
'objParam.Value = strFileNameOnly1
objParam = myCommand.Parameters.Add("
objParam.Value = taBeskrivning.Value
objParam = myCommand.Parameters.Add("
objParam.Value = strFileNameOnly1
objParam = myCommand.Parameters.Add("
objParam.Value = strFileNameOnly2
objParam = myCommand.Parameters.Add("
objParam.Value = strFileNameOnly3
objParam = myCommand.Parameters.Add("
objParam.Value = strFileNameOnly4
objParam = myCommand.Parameters.Add("
objParam.Value = strFileNameOnly5
objParam = myCommand.Parameters.Add("
objParam.Value = strFileNameOnly6
Try
myCommand.Connection.Open(
myCommand.ExecuteNonQuery(
myCommand.Connection.Close
Catch ex As OdbcException
lblMessage.Text = ex.Message
End Try
'nytt
Dim myConnection2 As OdbcConnection = New OdbcConnection(Configurati
Dim strTextFastig As String = tbFastighetsbeteckning.Val
'erstter Retur-slag med <br> tag
strTextFastig = Replace(strTextFastig, vbCrLf, "<br />")
Dim strTextBesk As String = taBeskrivning.Value
strTextBesk = Replace(strTextBesk, vbCrLf, "<br />")
Dim strTextPlanl As String = taPlanlosning.Value
strTextPlanl = Replace(strTextPlanl, vbCrLf, "<br />")
Dim strTextBygg As String = taByggnadssatt.Value
strTextBygg = Replace(strTextBygg, vbCrLf, "<br />")
Dim strTextPlanb As String = taPlanbestammelser.Value
strTextPlanb = Replace(strTextPlanb, vbCrLf, "<br />")
Dim strTextTomt As String = taTomtbeskrivning.Value
strTextTomt = Replace(strTextTomt, vbCrLf, "<br />")
Dim strTextGarage As String = taGarage.Value
strTextGarage = Replace(strTextGarage, vbCrLf, "<br />")
Dim strTextEkonomi As String = taEkonomi.Value
strTextEkonomi = Replace(strTextEkonomi, vbCrLf, "<br />")
Dim strTextOvrigt As String = taOvrigt.Value
strTextOvrigt = Replace(strTextOvrigt, vbCrLf, "<br />")
Dim myDataReader2 As OdbcDataReader
Dim myCommand2 As OdbcCommand = New OdbcCommand("INSERT INTO detaljer ( Fastighetsbeteckning, Beskrivning, Planlosning, Byggnadssatt, Planbestammelser, Tomtbeskrivning, Garage, Ekonomi, Ovrit ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", myConnection2)
'Ställ in parametrarna till den lagrade proceduren
Dim objParam2 As OdbcParameter
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextFastig
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextBesk
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextPlanl
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextBygg
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextPlanb
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextTomt
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextGarage
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextEkonomi
objParam2 = myCommand2.Parameters.Add(
objParam2.Value = strTextOvrigt
'objParam = myCommand.Parameters.Add("
'objParam.Value = taBild1.value
Try
myCommand2.Connection.Open
myCommand2.ExecuteNonQuery
myCommand2.Connection.Clos
Catch ex As OdbcException
lblMessage.Text = ex.Message
End Try
lblMessage.Text = "Bilderna och informationen har sparats i databasen."
Else
lblMessage.Text = "problem med att överföra informationen till databasen"
End If
End Sub
End Class
Are you right clicking on the "bilder" folder? That's the folder that needs the permissions set. You should be able to click "Properties", then the "Security Tab", and add the ASPNET user...
ASKER
The problem is when I right clickon the "bilder" folder and choose "Properties", I can not find any "Security Tab" to add the ASPNET user! I don't know why and how to solve the problem. Is there any other way?Thanks
What tabs do you see? What OS are you running?
ASKER
The tabs that I see are something like (General- Give away- Webb sharing- Adapt)
I'm running Windows XPprofessionals.
I'm running Windows XPprofessionals.
Are you navigating through explorer to the bilder folder? Or through IIS?
ASKER
I'm navigating through explorer to the "bilder" folder.
Should I do it through IIS? In this case what should I do exactly?Thanks
Should I do it through IIS? In this case what should I do exactly?Thanks
I've never seen a "Give Away" or "Adapt" tab. Not sure what's going on there....
The tabs you should see are:
General, Sharing, Security, Customize.
I'm using XP Pro as well....
The tabs you should see are:
General, Sharing, Security, Customize.
I'm using XP Pro as well....
ASKER
Sorry about the wrong translation from swedish to english.
The tabs that I see are:
General, Sharing, Security, Customize.
Is there anything I can do to solve the problem
The tabs that I see are:
General, Sharing, Security, Customize.
Is there anything I can do to solve the problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.