473,395 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" & strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=1"""

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

Reggie

Oct 18 '08 #1
12 1664
On Oct 18, 11:02*am, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
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=Microsoft.Jet.OLEDB.4.0;" _
* * * * & "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" & strFile)
& ";" & _
* * * * "Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.
Oct 18 '08 #2
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" <al************@gmail.comwrote in message
news:2c**********************************@v72g2000 hsv.googlegroups.com...
On Oct 18, 11:02 am, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" & strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.

Oct 18 '08 #3
On Oct 18, 10:26*pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" & strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=1"""

' create your excel connection object using the connection string
Dim objXConn As New OleDbConnection(xConnStr)
objXConn.Open()
Oct 19 '08 #4
Reggie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:7d**********************************@v72g2000 hsv.googlegroups.com...
On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" &
strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.PostedFile Is Nothing And
inpFileUpNIIN.PostedFile.ContentLength 0 Then
strFileName =
System.IO.Path.GetFileName(inpFileUpNIIN.PostedFil e.FileName)
strBaseDir = Server.MapPath("/MDB_Temp/")
Try
inpFileUpNIIN.PostedFile.SaveAs(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

Oct 20 '08 #5
"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Reggie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:7d**********************************@v72g2000 hsv.googlegroups.com...
On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
>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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" &
strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.PostedFile Is Nothing And
inpFileUpNIIN.PostedFile.ContentLength 0 Then
strFileName =
System.IO.Path.GetFileName(inpFileUpNIIN.PostedFil e.FileName)
strBaseDir = Server.MapPath("/MDB_Temp/")
Try
inpFileUpNIIN.PostedFile.SaveAs(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\ExcelIm port_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 authentication and not sure how to setup so I can
debug.

Oct 20 '08 #6
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*****************@yahoo.comwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Reggie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:7d**********************************@v72g200 0hsv.googlegroups.com...
On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
>>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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" &
strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.PostedFile Is Nothing And
inpFileUpNIIN.PostedFile.ContentLength 0 Then
strFileName =
System.IO.Path.GetFileName(inpFileUpNIIN.PostedFi le.FileName)
strBaseDir = Server.MapPath("/MDB_Temp/")
Try
inpFileUpNIIN.PostedFile.SaveAs(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\ExcelIm port_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
authentication and not sure how to setup so I can debug.

Oct 20 '08 #7
David Thanks for the reply. Did as you suggested but the aspnet_wp is not
in the list.

"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:%2****************@TK2MSFTNGP02.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*****************@yahoo.comwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
>"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>Reggie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:7d**********************************@v72g20 00hsv.googlegroups.com...
On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" &
strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.PostedFile Is Nothing And
inpFileUpNIIN.PostedFile.ContentLength 0 Then
strFileName =
System.IO.Path.GetFileName(inpFileUpNIIN.PostedF ile.FileName)
strBaseDir = Server.MapPath("/MDB_Temp/")
Try
inpFileUpNIIN.PostedFile.SaveAs(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\ExcelI mport_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
authentication and not sure how to setup so I can debug.

Oct 21 '08 #8
On Oct 20, 10:47*am, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
"Reggie" <No_Spam_chief123...@yahoo.comwrote 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\wwwroot\WSMDDT\WSMDDT\MDB_Temp\ExcelIm port_rep.xls'.
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\wwwroot\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.
Oct 21 '08 #9
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.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
David Thanks for the reply. Did as you suggested but the aspnet_wp is not
in the list.

"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:%2****************@TK2MSFTNGP02.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*****************@yahoo.comwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
>>"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
Reggie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:7d**********************************@v72g2 000hsv.googlegroups.com...
On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
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=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" &
strFile)
& ";" & _
"Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.PostedFile Is Nothing And
inpFileUpNIIN.PostedFile.ContentLength 0 Then
strFileName =
System.IO.Path.GetFileName(inpFileUpNIIN.Posted File.FileName)
strBaseDir = Server.MapPath("/MDB_Temp/")
Try
inpFileUpNIIN.PostedFile.SaveAs(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\Excel Import_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
authentication and not sure how to setup so I can debug.


Oct 21 '08 #10
David, Found it. (w3wp). Thanks!

--

Reggie
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:eZ**************@TK2MSFTNGP06.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.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>David Thanks for the reply. Did as you suggested but the aspnet_wp is
not in the list.

"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:%2****************@TK2MSFTNGP02.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*****************@yahoo.comwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
"Reggie" <No*****************@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl. ..
Reggie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:7d**********************************@v72g 2000hsv.googlegroups.com...
On Oct 18, 10:26 pm, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
>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=Microsoft.Jet.OLEDB.4.0;"
>_
> & "Data Source=" & Server.MapPath("WSMDDT_Old\MDB_Temp\" &
>strFile)
>& ";" & _
> "Extended Properties=""Excel 8.0;HDR=TRUE;IMEX=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.PostedFile Is Nothing And
inpFileUpNIIN.PostedFile.ContentLength 0 Then
strFileName =
System.IO.Path.GetFileName(inpFileUpNIIN.Poste dFile.FileName)
strBaseDir = Server.MapPath("/MDB_Temp/")
Try
inpFileUpNIIN.PostedFile.SaveAs(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\Exce lImport_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
authentication and not sure how to setup so I can debug.


Oct 21 '08 #11
gie
"Alexey Smirnov" <al************@gmail.comwrote in message
news:26**********************************@l76g2000 hse.googlegroups.com...
On Oct 20, 10:47 am, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
"Reggie" <No_Spam_chief123...@yahoo.comwrote 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\wwwroot\WSMDDT\WSMDDT\MDB_Temp\ExcelIm port_rep.xls'.
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\wwwroot\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\wwwroot\
Server.MapPath("/MDB_Temp/") returns C:\inetpub\wwwroot\MDB_Temp\
Server.MapPath("/WSMDDT/MDB_Temp/") returns
C:\inetpub\wwwroot\WSMDDT\MDB_Temp\

Running using VS Server

Server.MapPath("/") returns C:\inetpub\wwwroot\WSMDDT\
Server.MapPath("/MDB_Temp/") returns C:\inetpub\wwwroot\WSMDDT\MDB_Temp\
Server.MapPath("/WSMDDT/MDB_Temp/") returns
C:\inetpub\wwwroot\WSMDDT\WSMDDT\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

Oct 22 '08 #12
On Oct 22, 2:34*am, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
gie"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message

news:26**********************************@l76g2000 hse.googlegroups.com...
On Oct 20, 10:47 am, "Reggie" <No_Spam_chief123...@yahoo.comwrote:
"Reggie" <No_Spam_chief123...@yahoo.comwrote 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\wwwroot\WSMDDT\WSMDDT\MDB_Temp\ExcelIm port_rep.xls'.

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\wwwroot\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\wwwroot\
Server.MapPath("/MDB_Temp/") *returns C:\inetpub\wwwroot\MDB_Temp\
Server.MapPath("/WSMDDT/MDB_Temp/") *returns
C:\inetpub\wwwroot\WSMDDT\MDB_Temp\

Running using VS Server

Server.MapPath("/") *returns C:\inetpub\wwwroot\WSMDDT\
Server.MapPath("/MDB_Temp/") *returns C:\inetpub\wwwroot\WSMDDT\MDB_Temp\
Server.MapPath("/WSMDDT/MDB_Temp/") *returns
C:\inetpub\wwwroot\WSMDDT\WSMDDT\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!
Oct 22 '08 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chen Zhuo | last post by:
Hi, I need to write some code to test whether a folder has read/write permission. The idea is to try to read sub-directories in this folder, if succeed, then test whether it's read-only. Any...
1
by: Kiran_Juikar | last post by:
In my application, I want to copy some file from network location to local machine folder. It works fine for administrator but If I run it with restricted user (not having permissions to local...
6
by: Eric J. | last post by:
I am having a problem writing to an Access database. It only seems to work if the database is placed in c:\ Retrieving records from it is no problem when it is placed in a subdirectory of mapppath,...
4
by: Santaji | last post by:
Hi, We have an ASP.NET application which needs to write some files on the disk. For these we need to give ASP.NET user the Write permission for that particular folder. This is possible from...
3
by: frekster | last post by:
All. I have a folder/files that I have added asp.net to have read/write/etc. privlidges via the properties of the folder/files and security tab. However, when I run my asp.net page, I still get...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
10
by: Russell Mangel | last post by:
I have written the following program using VS2005. The program is a Dynamic Array similar to System.Collections.ArrayList in .NET. The program works okay until I reach 65536, I can't seem to figure...
2
by: Paul Lemke | last post by:
Hello, I currently have an application that uses authenticates users via NTLM. I would like to provide a user a directory listing of a folder. Everyone has read access to the folder, but the only...
1
by: Henok Girma | last post by:
Hello, I wanted to write to a folder from my ASP.NET web app, but i get Access to the path 'C:\Inetpub\wwwroot\Test\Logs\test.log' is denied. at System.IO.__Error.WinIOError(Int32 errorCode,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.