468,132 Members | 1,564 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,132 developers. It's quick & easy.

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 1498
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Eric J. | last post: by
4 posts views Thread by Santaji | last post: by
3 posts views Thread by frekster | last post: by
15 posts views Thread by David Thielen | last post: by
1 post views Thread by Henok Girma | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.