Can't write to folder

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Reggie

    Can't write to folder

    Hi And TIA. Running VS2005 and IIS7.0. I have a procedure that copies a
    file to a folder in my web application. When I run the project from VS it
    runs fine . I'm usin IE as default viewer. But when I type it directly into
    IE (http://localhost/Menu.aspx) it bombs when I try to open the connection
    cause the file doesn't get copied to the folder. Any thoughts/advice is
    appreciated.

    Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
    & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" & strFile)
    & ";" & _
    "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""

    ' create your excel connection object using the connection string
    Dim objXConn As New OleDbConnection (xConnStr)
    objXConn.Open()


    --

    Reggie

  • Alexey Smirnov

    #2
    Re: Can't write to folder

    On Oct 18, 11:02 am, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
    Hi And TIA.  Running VS2005 and IIS7.0.  I have a procedure that copies a
    file to a folder in my web application.  When I run the project from VSit
    runs fine . I'm usin IE as default viewer.  But when I type it directlyinto
    IE (http://localhost/Menu.aspx) it bombs when I try to open the connection
    cause the file doesn't get copied to the folder.  Any thoughts/advice is
    appreciated.
    >
            Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
            & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" & strFile)
    & ";" & _
            "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
    >
            ' create your excel connection object using the connection string
            Dim objXConn As New OleDbConnection (xConnStr)
            objXConn.Open()
    >
    --
    >
    Reggie
    When you run your code within VS you run it under your own user
    account and this works. IIS uses a built-in group named IIS_IUSRS
    (IUSR account) and it seems that this account has no rights on the
    destination folder. Give to the IIS_USRS the write access to the
    folder you want them to be able to write to. This can be done by
    navigating to your folder in Windows Explorer, right-clicking on the
    folder and selecting the Security Tab.

    Comment

    • Reggie

      #3
      Re: Can't write to folder

      IIS_IUSRS has all the permissions to write to the folder. Also, Network
      Services and many others I have given full rights to (only to try and get it
      to work), Nothing has worked yet. I'll keep trying.

      --

      Reggie
      "Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
      news:2cff45e6-8b4c-451f-bf03-bdcd256e6010@v7 2g2000hsv.googl egroups.com...
      On Oct 18, 11:02 am, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
      Hi And TIA. Running VS2005 and IIS7.0. I have a procedure that copies a
      file to a folder in my web application. When I run the project from VS it
      runs fine . I'm usin IE as default viewer. But when I type it directly
      into
      IE (http://localhost/Menu.aspx) it bombs when I try to open the connection
      cause the file doesn't get copied to the folder. Any thoughts/advice is
      appreciated.
      >
      Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
      & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" & strFile)
      & ";" & _
      "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
      >
      ' create your excel connection object using the connection string
      Dim objXConn As New OleDbConnection (xConnStr)
      objXConn.Open()
      >
      --
      >
      Reggie
      When you run your code within VS you run it under your own user
      account and this works. IIS uses a built-in group named IIS_IUSRS
      (IUSR account) and it seems that this account has no rights on the
      destination folder. Give to the IIS_USRS the write access to the
      folder you want them to be able to write to. This can be done by
      navigating to your folder in Windows Explorer, right-clicking on the
      folder and selecting the Security Tab.

      Comment

      • Alexey Smirnov

        #4
        Re: Can't write to folder

        On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
        IIS_IUSRS has all the permissions to write to the folder.  Also, Network
        Services and many others I have given full rights to (only to try and getit
        to work),  Nothing has worked yet.  I'll keep trying.
        >

        Maybe there is another problem then. Did you get an error about
        insufficient write permissions, or the code is not working as
        expected? if the latter is the case can you post the code? I don't see
        anything what copies a file in the snippet you sent earlier
        Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
        & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" & strFile)
        & ";" & _
        "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
        >
        ' create your excel connection object using the connection string
        Dim objXConn As New OleDbConnection (xConnStr)
        objXConn.Open()

        Comment

        • Reggie

          #5
          Re: Can't write to folder

          Reggie
          "Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
          news:7dbd83f5-c2b6-4f97-987d-8b11407fb89e@v7 2g2000hsv.googl egroups.com...
          On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
          IIS_IUSRS has all the permissions to write to the folder. Also, Network
          Services and many others I have given full rights to (only to try and get
          it
          to work), Nothing has worked yet. I'll keep trying.
          >

          Maybe there is another problem then. Did you get an error about
          insufficient write permissions, or the code is not working as
          expected? if the latter is the case can you post the code? I don't see
          anything what copies a file in the snippet you sent earlier
          Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
          & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" &
          strFile)
          & ";" & _
          "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
          >
          ' create your excel connection object using the connection string
          Dim objXConn As New OleDbConnection (xConnStr)
          objXConn.Open()
          No error message except stating that the file couldn't be found. Here's the
          code. Everything runs fine when running from local except when I try to
          copy a file to this folder.

          'Import Excel file
          If Not inpFileUpNIIN.P ostedFile Is Nothing And
          inpFileUpNIIN.P ostedFile.Conte ntLength 0 Then
          strFileName =
          System.IO.Path. GetFileName(inp FileUpNIIN.Post edFile.FileName )
          strBaseDir = Server.MapPath( "/MDB_Temp/")
          Try
          inpFileUpNIIN.P ostedFile.SaveA s(strBaseDir & strFileName)
          pathandfile = strBaseDir & strFileName
          Catch Exc As Exception
          Response.Write( "Error: " & Exc.Message)
          Exit Sub
          End Try
          Else
          Response.Write( "Please select a file to upload.")
          Exit Sub
          End If

          Comment

          • Reggie

            #6
            Re: Can't write to folder

            "Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
            news:%23ZCvZNoM JHA.3744@TK2MSF TNGP05.phx.gbl. ..
            Reggie
            "Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
            news:7dbd83f5-c2b6-4f97-987d-8b11407fb89e@v7 2g2000hsv.googl egroups.com...
            On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
            >IIS_IUSRS has all the permissions to write to the folder. Also, Network
            >Services and many others I have given full rights to (only to try and get
            >it
            >to work), Nothing has worked yet. I'll keep trying.
            >>
            >
            >
            Maybe there is another problem then. Did you get an error about
            insufficient write permissions, or the code is not working as
            expected? if the latter is the case can you post the code? I don't see
            anything what copies a file in the snippet you sent earlier
            >
            > Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
            > & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" &
            >strFile)
            >& ";" & _
            > "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
            >>
            > ' create your excel connection object using the connection string
            > Dim objXConn As New OleDbConnection (xConnStr)
            > objXConn.Open()
            >
            No error message except stating that the file couldn't be found. Here's
            the code. Everything runs fine when running from local except when I try
            to copy a file to this folder.
            >
            'Import Excel file
            If Not inpFileUpNIIN.P ostedFile Is Nothing And
            inpFileUpNIIN.P ostedFile.Conte ntLength 0 Then
            strFileName =
            System.IO.Path. GetFileName(inp FileUpNIIN.Post edFile.FileName )
            strBaseDir = Server.MapPath( "/MDB_Temp/")
            Try
            inpFileUpNIIN.P ostedFile.SaveA s(strBaseDir & strFileName)
            pathandfile = strBaseDir & strFileName
            Catch Exc As Exception
            Response.Write( "Error: " & Exc.Message)
            Exit Sub
            End Try
            Else
            Response.Write( "Please select a file to upload.")
            Exit Sub
            End If
            Got it somewhat figured out, but don't know why. If I run it using VS
            server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says it
            Could not find a part of the path
            'C:\inetpub\www root\WSMDDT\WSM DDT\MDB_Temp\Ex celImport_rep.x ls'. If I us VS
            and set it to Server.MapPath( "/MDB_Temp/") it runs fine but then it doesn't
            run when using the local server. I don't know why. I simply setup VS to
            run it using IIS server with Server.MapPath( "/WSMDDT/MDB_Temp/") and it now
            runs except I can debug cause integrated windows authentication isn't
            enabled. I'm using forms authentication and not sure how to setup so I can
            debug.

            Comment

            • David

              #7
              Re: Can't write to folder

              To debug without running via studio, click Tools / Attach to Process.

              Select the aspnet_wp process (hover over it first to ensure you are
              debugging the correct version. On my machine, I have 1.1 and 2.0) I also
              ensure in the attach to block that SQL Server is not selected. (Click the
              select button to remove it).

              Click Attach.

              Debug as normal.

              Personally, I prefer this way of handling it. I don't like the start button
              starting up a browser and when you click stop, the browser closing again.

              --
              Best regards,
              Dave Colliver.

              ~~
              http://www.FOCUSPortals.com - Local franchises available


              "Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
              news:uWmr3BpMJH A.3744@TK2MSFTN GP05.phx.gbl...
              "Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
              news:%23ZCvZNoM JHA.3744@TK2MSF TNGP05.phx.gbl. ..
              >Reggie
              >"Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
              >news:7dbd83f 5-c2b6-4f97-987d-8b11407fb89e@v7 2g2000hsv.googl egroups.com...
              >On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
              >>IIS_IUSRS has all the permissions to write to the folder. Also, Network
              >>Services and many others I have given full rights to (only to try and
              >>get it
              >>to work), Nothing has worked yet. I'll keep trying.
              >>>
              >>
              >>
              >Maybe there is another problem then. Did you get an error about
              >insufficient write permissions, or the code is not working as
              >expected? if the latter is the case can you post the code? I don't see
              >anything what copies a file in the snippet you sent earlier
              >>
              >> Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
              >> & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" &
              >>strFile)
              >>& ";" & _
              >> "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
              >>>
              >> ' create your excel connection object using the connection
              >>string
              >> Dim objXConn As New OleDbConnection (xConnStr)
              >> objXConn.Open()
              >>
              >No error message except stating that the file couldn't be found. Here's
              >the code. Everything runs fine when running from local except when I try
              >to copy a file to this folder.
              >>
              > 'Import Excel file
              > If Not inpFileUpNIIN.P ostedFile Is Nothing And
              >inpFileUpNIIN. PostedFile.Cont entLength 0 Then
              > strFileName =
              >System.IO.Path .GetFileName(in pFileUpNIIN.Pos tedFile.FileNam e)
              > strBaseDir = Server.MapPath( "/MDB_Temp/")
              > Try
              > inpFileUpNIIN.P ostedFile.SaveA s(strBaseDir & strFileName)
              > pathandfile = strBaseDir & strFileName
              > Catch Exc As Exception
              > Response.Write( "Error: " & Exc.Message)
              > Exit Sub
              > End Try
              > Else
              > Response.Write( "Please select a file to upload.")
              > Exit Sub
              > End If
              >
              Got it somewhat figured out, but don't know why. If I run it using VS
              server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says it
              Could not find a part of the path
              'C:\inetpub\www root\WSMDDT\WSM DDT\MDB_Temp\Ex celImport_rep.x ls'. If I us
              VS and set it to Server.MapPath( "/MDB_Temp/") it runs fine but then it
              doesn't run when using the local server. I don't know why. I simply
              setup VS to run it using IIS server with
              Server.MapPath( "/WSMDDT/MDB_Temp/") and it now runs except I can debug
              cause integrated windows authentication isn't enabled. I'm using forms
              authentication and not sure how to setup so I can debug.

              Comment

              • Reggie

                #8
                Re: Can't write to folder

                David Thanks for the reply. Did as you suggested but the aspnet_wp is not
                in the list.

                "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
                news:%23Rew4fvM JHA.5060@TK2MSF TNGP02.phx.gbl. ..
                To debug without running via studio, click Tools / Attach to Process.
                >
                Select the aspnet_wp process (hover over it first to ensure you are
                debugging the correct version. On my machine, I have 1.1 and 2.0) I also
                ensure in the attach to block that SQL Server is not selected. (Click the
                select button to remove it).
                >
                Click Attach.
                >
                Debug as normal.
                >
                Personally, I prefer this way of handling it. I don't like the start
                button starting up a browser and when you click stop, the browser closing
                again.
                >
                --
                Best regards,
                Dave Colliver.

                ~~
                http://www.FOCUSPortals.com - Local franchises available
                >
                >
                "Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                news:uWmr3BpMJH A.3744@TK2MSFTN GP05.phx.gbl...
                >"Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                >news:%23ZCvZNo MJHA.3744@TK2MS FTNGP05.phx.gbl ...
                >>Reggie
                >>"Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
                >>news:7dbd83 f5-c2b6-4f97-987d-8b11407fb89e@v7 2g2000hsv.googl egroups.com...
                >>On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                >>>IIS_IUSRS has all the permissions to write to the folder. Also, Network
                >>>Services and many others I have given full rights to (only to try and
                >>>get it
                >>>to work), Nothing has worked yet. I'll keep trying.
                >>>>
                >>>
                >>>
                >>Maybe there is another problem then. Did you get an error about
                >>insufficien t write permissions, or the code is not working as
                >>expected? if the latter is the case can you post the code? I don't see
                >>anything what copies a file in the snippet you sent earlier
                >>>
                >>> Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
                >>> & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" &
                >>>strFile)
                >>>& ";" & _
                >>> "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
                >>>>
                >>> ' create your excel connection object using the connection
                >>>string
                >>> Dim objXConn As New OleDbConnection (xConnStr)
                >>> objXConn.Open()
                >>>
                >>No error message except stating that the file couldn't be found. Here's
                >>the code. Everything runs fine when running from local except when I
                >>try to copy a file to this folder.
                >>>
                >> 'Import Excel file
                >> If Not inpFileUpNIIN.P ostedFile Is Nothing And
                >>inpFileUpNIIN .PostedFile.Con tentLength 0 Then
                >> strFileName =
                >>System.IO.Pat h.GetFileName(i npFileUpNIIN.Po stedFile.FileNa me)
                >> strBaseDir = Server.MapPath( "/MDB_Temp/")
                >> Try
                >> inpFileUpNIIN.P ostedFile.SaveA s(strBaseDir & strFileName)
                >> pathandfile = strBaseDir & strFileName
                >> Catch Exc As Exception
                >> Response.Write( "Error: " & Exc.Message)
                >> Exit Sub
                >> End Try
                >> Else
                >> Response.Write( "Please select a file to upload.")
                >> Exit Sub
                >> End If
                >>
                >Got it somewhat figured out, but don't know why. If I run it using VS
                >server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says it
                >Could not find a part of the path
                >'C:\inetpub\ww wroot\WSMDDT\WS MDDT\MDB_Temp\E xcelImport_rep. xls'. If I us
                >VS and set it to Server.MapPath( "/MDB_Temp/") it runs fine but then it
                >doesn't run when using the local server. I don't know why. I simply
                >setup VS to run it using IIS server with
                >Server.MapPath ("/WSMDDT/MDB_Temp/") and it now runs except I can debug
                >cause integrated windows authentication isn't enabled. I'm using forms
                >authenticati on and not sure how to setup so I can debug.
                >
                >

                Comment

                • Alexey Smirnov

                  #9
                  Re: Can't write to folder

                  On Oct 20, 10:47 am, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                  "Reggie" <No_Spam_chief1 23...@yahoo.com wrote in message
                  Got it somewhat figured out, but don't know why.  If I run it using VS
                  server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says it
                  Could not find a part of the path
                  'C:\inetpub\www root\WSMDDT\WSM DDT\MDB_Temp\Ex celImport_rep.x ls'.
                  So, what path do you get when you call Server.MapPath( "/") ? What
                  webserver do you use in VS (Project - Properties - Web) ?

                  I think the problem is in your configuration - your site is located in
                  C:\inetpub\wwwr oot\WSMDDT, you call Server.MapPath( "/WSMDDT/
                  MDB_Temp/") which is wrong, and you get an error. To see why it is not
                  working under http://localhost - remove Try..Catch..End . It should
                  show an error message after that.

                  Hope this helps.

                  Comment

                  • David

                    #10
                    Re: Can't write to folder

                    If it isn't in the list when you try, then if you have not used your local
                    web for a while, it will have closed itself down. Simply open a browser and
                    goto your local site (ensure you call a .NET page, doesn't even need to be
                    in the same project) and that will start your aspnet_wp. (On different OS,
                    (vista I think) it could be called w3wp, on XP it is aspnet_wp).

                    Hope this helps.

                    --
                    Best regards,
                    Dave Colliver.

                    ~~
                    http://www.FOCUSPortals.com - Local franchises available


                    "Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                    news:%23N9Mxj0M JHA.5428@TK2MSF TNGP02.phx.gbl. ..
                    David Thanks for the reply. Did as you suggested but the aspnet_wp is not
                    in the list.
                    >
                    "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
                    news:%23Rew4fvM JHA.5060@TK2MSF TNGP02.phx.gbl. ..
                    >To debug without running via studio, click Tools / Attach to Process.
                    >>
                    >Select the aspnet_wp process (hover over it first to ensure you are
                    >debugging the correct version. On my machine, I have 1.1 and 2.0) I also
                    >ensure in the attach to block that SQL Server is not selected. (Click the
                    >select button to remove it).
                    >>
                    >Click Attach.
                    >>
                    >Debug as normal.
                    >>
                    >Personally, I prefer this way of handling it. I don't like the start
                    >button starting up a browser and when you click stop, the browser closing
                    >again.
                    >>
                    >--
                    >Best regards,
                    >Dave Colliver.
                    >http://www.AshfieldFOCUS.com
                    >~~
                    >http://www.FOCUSPortals.com - Local franchises available
                    >>
                    >>
                    >"Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                    >news:uWmr3BpMJ HA.3744@TK2MSFT NGP05.phx.gbl.. .
                    >>"Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                    >>news:%23ZCvZN oMJHA.3744@TK2M SFTNGP05.phx.gb l...
                    >>>Reggie
                    >>>"Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
                    >>>news:7dbd83f 5-c2b6-4f97-987d-8b11407fb89e@v7 2g2000hsv.googl egroups.com...
                    >>>On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                    >>>>IIS_IUSRS has all the permissions to write to the folder. Also,
                    >>>>Network
                    >>>>Services and many others I have given full rights to (only to try and
                    >>>>get it
                    >>>>to work), Nothing has worked yet. I'll keep trying.
                    >>>>>
                    >>>>
                    >>>>
                    >>>Maybe there is another problem then. Did you get an error about
                    >>>insufficie nt write permissions, or the code is not working as
                    >>>expected? if the latter is the case can you post the code? I don't see
                    >>>anything what copies a file in the snippet you sent earlier
                    >>>>
                    >>>> Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" _
                    >>>> & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" &
                    >>>>strFile)
                    >>>>& ";" & _
                    >>>> "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
                    >>>>>
                    >>>> ' create your excel connection object using the connection
                    >>>>string
                    >>>> Dim objXConn As New OleDbConnection (xConnStr)
                    >>>> objXConn.Open()
                    >>>>
                    >>>No error message except stating that the file couldn't be found.
                    >>>Here's the code. Everything runs fine when running from local except
                    >>>when I try to copy a file to this folder.
                    >>>>
                    >>> 'Import Excel file
                    >>> If Not inpFileUpNIIN.P ostedFile Is Nothing And
                    >>>inpFileUpNII N.PostedFile.Co ntentLength 0 Then
                    >>> strFileName =
                    >>>System.IO.Pa th.GetFileName( inpFileUpNIIN.P ostedFile.FileN ame)
                    >>> strBaseDir = Server.MapPath( "/MDB_Temp/")
                    >>> Try
                    >>> inpFileUpNIIN.P ostedFile.SaveA s(strBaseDir &
                    >>>strFileNam e)
                    >>> pathandfile = strBaseDir & strFileName
                    >>> Catch Exc As Exception
                    >>> Response.Write( "Error: " & Exc.Message)
                    >>> Exit Sub
                    >>> End Try
                    >>> Else
                    >>> Response.Write( "Please select a file to upload.")
                    >>> Exit Sub
                    >>> End If
                    >>>
                    >>Got it somewhat figured out, but don't know why. If I run it using VS
                    >>server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says
                    >>it Could not find a part of the path
                    >>'C:\inetpub\w wwroot\WSMDDT\W SMDDT\MDB_Temp\ ExcelImport_rep .xls'. If I
                    >>us VS and set it to Server.MapPath( "/MDB_Temp/") it runs fine but then
                    >>it doesn't run when using the local server. I don't know why. I simply
                    >>setup VS to run it using IIS server with
                    >>Server.MapPat h("/WSMDDT/MDB_Temp/") and it now runs except I can debug
                    >>cause integrated windows authentication isn't enabled. I'm using forms
                    >>authenticatio n and not sure how to setup so I can debug.
                    >>
                    >>
                    >

                    Comment

                    • Reggie

                      #11
                      Re: Can't write to folder

                      David, Found it. (w3wp). Thanks!

                      --

                      Reggie
                      "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
                      news:eZGF9L1MJH A.2324@TK2MSFTN GP06.phx.gbl...
                      If it isn't in the list when you try, then if you have not used your local
                      web for a while, it will have closed itself down. Simply open a browser
                      and goto your local site (ensure you call a .NET page, doesn't even need
                      to be in the same project) and that will start your aspnet_wp. (On
                      different OS, (vista I think) it could be called w3wp, on XP it is
                      aspnet_wp).
                      >
                      Hope this helps.
                      >
                      --
                      Best regards,
                      Dave Colliver.

                      ~~
                      http://www.FOCUSPortals.com - Local franchises available
                      >
                      >
                      "Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                      news:%23N9Mxj0M JHA.5428@TK2MSF TNGP02.phx.gbl. ..
                      >David Thanks for the reply. Did as you suggested but the aspnet_wp is
                      >not in the list.
                      >>
                      >"David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
                      >news:%23Rew4fv MJHA.5060@TK2MS FTNGP02.phx.gbl ...
                      >>To debug without running via studio, click Tools / Attach to Process.
                      >>>
                      >>Select the aspnet_wp process (hover over it first to ensure you are
                      >>debugging the correct version. On my machine, I have 1.1 and 2.0) I also
                      >>ensure in the attach to block that SQL Server is not selected. (Click
                      >>the select button to remove it).
                      >>>
                      >>Click Attach.
                      >>>
                      >>Debug as normal.
                      >>>
                      >>Personally, I prefer this way of handling it. I don't like the start
                      >>button starting up a browser and when you click stop, the browser
                      >>closing again.
                      >>>
                      >>--
                      >>Best regards,
                      >>Dave Colliver.
                      >>http://www.AshfieldFOCUS.com
                      >>~~
                      >>http://www.FOCUSPortals.com - Local franchises available
                      >>>
                      >>>
                      >>"Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                      >>news:uWmr3BpM JHA.3744@TK2MSF TNGP05.phx.gbl. ..
                      >>>"Reggie" <No_Spam_chief1 23101@yahoo.com wrote in message
                      >>>news:%23ZCvZ NoMJHA.3744@TK2 MSFTNGP05.phx.g bl...
                      >>>>Reggie
                      >>>>"Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
                      >>>>news:7dbd83 f5-c2b6-4f97-987d-8b11407fb89e@v7 2g2000hsv.googl egroups.com...
                      >>>>On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                      >>>>>IIS_IUSR S has all the permissions to write to the folder. Also,
                      >>>>>Network
                      >>>>>Services and many others I have given full rights to (only to try and
                      >>>>>get it
                      >>>>>to work), Nothing has worked yet. I'll keep trying.
                      >>>>>>
                      >>>>>
                      >>>>>
                      >>>>Maybe there is another problem then. Did you get an error about
                      >>>>insufficien t write permissions, or the code is not working as
                      >>>>expected? if the latter is the case can you post the code? I don't see
                      >>>>anything what copies a file in the snippet you sent earlier
                      >>>>>
                      >>>>> Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;"
                      >>>>>_
                      >>>>> & "Data Source=" & Server.MapPath( "WSMDDT_Old\MDB _Temp\" &
                      >>>>>strFile)
                      >>>>>& ";" & _
                      >>>>> "Extended Properties=""Ex cel 8.0;HDR=TRUE;IM EX=1"""
                      >>>>>>
                      >>>>> ' create your excel connection object using the connection
                      >>>>>string
                      >>>>> Dim objXConn As New OleDbConnection (xConnStr)
                      >>>>> objXConn.Open()
                      >>>>>
                      >>>>No error message except stating that the file couldn't be found.
                      >>>>Here's the code. Everything runs fine when running from local except
                      >>>>when I try to copy a file to this folder.
                      >>>>>
                      >>>> 'Import Excel file
                      >>>> If Not inpFileUpNIIN.P ostedFile Is Nothing And
                      >>>>inpFileUpNI IN.PostedFile.C ontentLength 0 Then
                      >>>> strFileName =
                      >>>>System.IO.P ath.GetFileName (inpFileUpNIIN. PostedFile.File Name)
                      >>>> strBaseDir = Server.MapPath( "/MDB_Temp/")
                      >>>> Try
                      >>>> inpFileUpNIIN.P ostedFile.SaveA s(strBaseDir &
                      >>>>strFileName )
                      >>>> pathandfile = strBaseDir & strFileName
                      >>>> Catch Exc As Exception
                      >>>> Response.Write( "Error: " & Exc.Message)
                      >>>> Exit Sub
                      >>>> End Try
                      >>>> Else
                      >>>> Response.Write( "Please select a file to upload.")
                      >>>> Exit Sub
                      >>>> End If
                      >>>>
                      >>>Got it somewhat figured out, but don't know why. If I run it using VS
                      >>>server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says
                      >>>it Could not find a part of the path
                      >>>'C:\inetpub\ wwwroot\WSMDDT\ WSMDDT\MDB_Temp \ExcelImport_re p.xls'. If I
                      >>>us VS and set it to Server.MapPath( "/MDB_Temp/") it runs fine but then
                      >>>it doesn't run when using the local server. I don't know why. I
                      >>>simply setup VS to run it using IIS server with
                      >>>Server.MapPa th("/WSMDDT/MDB_Temp/") and it now runs except I can debug
                      >>>cause integrated windows authentication isn't enabled. I'm using forms
                      >>>authenticati on and not sure how to setup so I can debug.
                      >>>
                      >>>
                      >>
                      >
                      >

                      Comment

                      • Reggie

                        #12
                        Re: Can't write to folder

                        gie
                        "Alexey Smirnov" <alexey.smirnov @gmail.comwrote in message
                        news:2669304d-e7da-45b6-a8b7-946ab29d687b@l7 6g2000hse.googl egroups.com...
                        On Oct 20, 10:47 am, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                        "Reggie" <No_Spam_chief1 23...@yahoo.com wrote in message
                        Got it somewhat figured out, but don't know why. If I run it using VS
                        server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says it
                        Could not find a part of the path
                        'C:\inetpub\www root\WSMDDT\WSM DDT\MDB_Temp\Ex celImport_rep.x ls'.
                        So, what path do you get when you call Server.MapPath( "/") ? What
                        webserver do you use in VS (Project - Properties - Web) ?

                        I think the problem is in your configuration - your site is located in
                        C:\inetpub\wwwr oot\WSMDDT, you call Server.MapPath( "/WSMDDT/
                        MDB_Temp/") which is wrong, and you get an error. To see why it is not
                        working under http://localhost - remove Try..Catch..End . It should
                        show an error message after that.

                        Hope this helps.

                        Using IIS 7.0 Server
                        Vista Business (SP1)
                        VS2005
                        ..Net 2.0 (SP1)

                        Running using IIS Server

                        Server.MapPath( "/") returns C:\inetpub\wwwr oot\
                        Server.MapPath( "/MDB_Temp/") returns C:\inetpub\wwwr oot\MDB_Temp\
                        Server.MapPath( "/WSMDDT/MDB_Temp/") returns
                        C:\inetpub\wwwr oot\WSMDDT\MDB_ Temp\

                        Running using VS Server

                        Server.MapPath( "/") returns C:\inetpub\wwwr oot\WSMDDT\
                        Server.MapPath( "/MDB_Temp/") returns C:\inetpub\wwwr oot\WSMDDT\MDB_ Temp\
                        Server.MapPath( "/WSMDDT/MDB_Temp/") returns
                        C:\inetpub\wwwr oot\WSMDDT\WSMD DT\MDB_Temp\


                        The last one (running using IIS Server) is what I want and it is working as
                        expected. My problem was that when I originally posted my question I was
                        using VS server and the Server.MapPath( "/WSMDDT/MDB_Temp/") failed, however
                        when I took out the WSMDDT portion so that it read
                        Server.MapPath( "/MDB_Temp/") It ran fine from VS, but failed when I tried to
                        simply run the app from the local server. Think I'm good now cause I set it
                        up to run from IIS server and all is well. Just thought it was/is odd that
                        this happens. Thanks VERY much for all the help.
                        --

                        Reg

                        Comment

                        • Alexey Smirnov

                          #13
                          Re: Can't write to folder

                          On Oct 22, 2:34 am, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                          gie"Alexey Smirnov" <alexey.smir... @gmail.comwrote in message
                          >
                          news:2669304d-e7da-45b6-a8b7-946ab29d687b@l7 6g2000hse.googl egroups.com...
                          On Oct 20, 10:47 am, "Reggie" <No_Spam_chief1 23...@yahoo.com wrote:
                          >
                          "Reggie" <No_Spam_chief1 23...@yahoo.com wrote in message
                          Got it somewhat figured out, but don't know why. If I run it using VS
                          server and use the setting Server.MapPath( "/WSMDDT/MDB_Temp/") it says it
                          Could not find a part of the path
                          'C:\inetpub\www root\WSMDDT\WSM DDT\MDB_Temp\Ex celImport_rep.x ls'.
                          >
                          So, what path do you get when you call Server.MapPath( "/") ? What
                          webserver do you use in VS (Project - Properties - Web) ?
                          >
                          I think the problem is in your configuration - your site is located in
                          C:\inetpub\wwwr oot\WSMDDT, you call Server.MapPath( "/WSMDDT/
                          MDB_Temp/") which is wrong, and you get an error. To see why it is not
                          working underhttp://localhost- remove Try..Catch..End . It should
                          show an error message after that.
                          >
                          Hope this helps.
                          >
                          Using IIS 7.0 Server
                          Vista Business (SP1)
                          VS2005
                          .Net 2.0 (SP1)
                          >
                          Running using IIS Server
                          >
                          Server.MapPath( "/")  returns C:\inetpub\wwwr oot\
                          Server.MapPath( "/MDB_Temp/")  returns C:\inetpub\wwwr oot\MDB_Temp\
                          Server.MapPath( "/WSMDDT/MDB_Temp/")  returns
                          C:\inetpub\wwwr oot\WSMDDT\MDB_ Temp\
                          >
                          Running using VS Server
                          >
                          Server.MapPath( "/")  returns C:\inetpub\wwwr oot\WSMDDT\
                          Server.MapPath( "/MDB_Temp/")  returns C:\inetpub\wwwr oot\WSMDDT\MDB_ Temp\
                          Server.MapPath( "/WSMDDT/MDB_Temp/")  returns
                          C:\inetpub\wwwr oot\WSMDDT\WSMD DT\MDB_Temp\
                          >
                          The last one (running using IIS Server) is what I want and it is working as
                          expected.  My problem was that when I originally posted my question I was
                          using VS server and the Server.MapPath( "/WSMDDT/MDB_Temp/") failed, however
                          when I took out the WSMDDT portion so that it read
                          Server.MapPath( "/MDB_Temp/") It ran fine from VS, but failed when I triedto
                          simply run the app from the local server.  Think I'm good now cause I set it
                          up to run from IIS server and all is well.  Just thought it was/is odd that
                          this happens.  Thanks VERY much for all the help.
                          --
                          >
                          Reg
                          Great that it works for you now. Cheers!

                          Comment

                          Working...