473,327 Members | 2,094 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,327 software developers and data experts.

Application.StartupPath

I have a VB.Net 2005 application that I am publishing to a network file
server.

The app reads an xml file that has some database connection information in
it. This xml file is located in the same folder as the executable.

The problem is when I double click on the appname.application on the server
the program can't find the xml file because the Application.StartupPath is:

C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...

So it looks like the program is being run from the local client rather than
the file server.

Why is that happening and is there some way to find out inside the program
where the .exe really is located?

Rick
Oct 28 '06 #1
4 6236
Well, I figured out part of the problem.

I'm new to VB.net and did not understand that I was Publishing the
application and clicking on the .application was installing it on the local
computer.

However when I just copy the exe file to the file server (along with the xml
file for db configuration) I get an unhandled exception. What should I be
doing to get the exe to run on the server from a common location so all
clients can access it

"Rick" <Ri**@LakeValleySeed.comwrote in message
news:eV****************@TK2MSFTNGP05.phx.gbl...
>I have a VB.Net 2005 application that I am publishing to a network file
server.

The app reads an xml file that has some database connection information in
it. This xml file is located in the same folder as the executable.

The problem is when I double click on the appname.application on the
server the program can't find the xml file because the
Application.StartupPath is:

C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...

So it looks like the program is being run from the local client rather
than the file server.

Why is that happening and is there some way to find out inside the program
where the .exe really is located?

Rick

Oct 28 '06 #2
I'm guessing you're getting a security access violation? This is due to
the fact that the .Net code security policy by default doesn't like
programs deployed on network drives (the permission set for local
intranet is almost nothing). Anyways, if I'm right then follow the
bellow steps to change your app's security policy settings.

Goto control panel --admin tools --Microsoft .Net Framework 2.0
Configuration. Expand the Runtime Security Policy Node. Expand the
Machine Level node.
Expand the Code Groups node. Right click on the All_Code node and
select "New..." Follow the wizard to build the new permission set (I
normally use strong name - see the .Net help for how to add a strong
name to you're solution). After you finish the wizard, you should be go
to go (on your computer at least!) So before you exit the Framework
Configuration, right click on "Runtime Security Policy" and select
"Create Deployment Package" and follow the wizard (be sure to select
Machine Level). This msi installer has to be run on each computer that
is going to use your program, and it must be run of the local drive -
running it from the network drive will not do anything. I had our
company's Network admin set up a login script to run the installer - I
think it the easiest way to accomplish it.

Let me know if that helps,

Seth Rowe
Rick wrote:
Well, I figured out part of the problem.

I'm new to VB.net and did not understand that I was Publishing the
application and clicking on the .application was installing it on the local
computer.

However when I just copy the exe file to the file server (along with the xml
file for db configuration) I get an unhandled exception. What should I be
doing to get the exe to run on the server from a common location so all
clients can access it

"Rick" <Ri**@LakeValleySeed.comwrote in message
news:eV****************@TK2MSFTNGP05.phx.gbl...
I have a VB.Net 2005 application that I am publishing to a network file
server.

The app reads an xml file that has some database connection information in
it. This xml file is located in the same folder as the executable.

The problem is when I double click on the appname.application on the
server the program can't find the xml file because the
Application.StartupPath is:

C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...

So it looks like the program is being run from the local client rather
than the file server.

Why is that happening and is there some way to find out inside the program
where the .exe really is located?

Rick
Oct 29 '06 #3
thanks Seth,

I'm plodding through this very unfamiliar territory!

First I had to do a repair on .NET 2.0 since there was no mscorcfg.msc ever
created for v 2.0. Odd since it should have been installed when I installed
VS 2005.

Anyway now I've got that up and running and can proceed.

Firstly, from what I see about Strong names, it seems they are just for dll
signing. I have an executable. Is this correct, or is it possible to
create a strong name for exe's as well?

Rick

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
I'm guessing you're getting a security access violation? This is due to
the fact that the .Net code security policy by default doesn't like
programs deployed on network drives (the permission set for local
intranet is almost nothing). Anyways, if I'm right then follow the
bellow steps to change your app's security policy settings.

Goto control panel --admin tools --Microsoft .Net Framework 2.0
Configuration. Expand the Runtime Security Policy Node. Expand the
Machine Level node.
Expand the Code Groups node. Right click on the All_Code node and
select "New..." Follow the wizard to build the new permission set (I
normally use strong name - see the .Net help for how to add a strong
name to you're solution). After you finish the wizard, you should be go
to go (on your computer at least!) So before you exit the Framework
Configuration, right click on "Runtime Security Policy" and select
"Create Deployment Package" and follow the wizard (be sure to select
Machine Level). This msi installer has to be run on each computer that
is going to use your program, and it must be run of the local drive -
running it from the network drive will not do anything. I had our
company's Network admin set up a login script to run the installer - I
think it the easiest way to accomplish it.

Let me know if that helps,

Seth Rowe
Rick wrote:
>Well, I figured out part of the problem.

I'm new to VB.net and did not understand that I was Publishing the
application and clicking on the .application was installing it on the
local
computer.

However when I just copy the exe file to the file server (along with the
xml
file for db configuration) I get an unhandled exception. What should I
be
doing to get the exe to run on the server from a common location so all
clients can access it

"Rick" <Ri**@LakeValleySeed.comwrote in message
news:eV****************@TK2MSFTNGP05.phx.gbl...
>I have a VB.Net 2005 application that I am publishing to a network file
server.

The app reads an xml file that has some database connection information
in
it. This xml file is located in the same folder as the executable.

The problem is when I double click on the appname.application on the
server the program can't find the xml file because the
Application.StartupPath is:

C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...

So it looks like the program is being run from the local client rather
than the file server.

Why is that happening and is there some way to find out inside the
program
where the .exe really is located?

Rick

Oct 29 '06 #4
You can strong name an exe. Just go to your project properties - it's
on one of the tabs there.

Thanks,

Seth Rowe
Rick wrote:
thanks Seth,

I'm plodding through this very unfamiliar territory!

First I had to do a repair on .NET 2.0 since there was no mscorcfg.msc ever
created for v 2.0. Odd since it should have been installed when I installed
VS 2005.

Anyway now I've got that up and running and can proceed.

Firstly, from what I see about Strong names, it seems they are just for dll
signing. I have an executable. Is this correct, or is it possible to
create a strong name for exe's as well?

Rick

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
I'm guessing you're getting a security access violation? This is due to
the fact that the .Net code security policy by default doesn't like
programs deployed on network drives (the permission set for local
intranet is almost nothing). Anyways, if I'm right then follow the
bellow steps to change your app's security policy settings.

Goto control panel --admin tools --Microsoft .Net Framework 2.0
Configuration. Expand the Runtime Security Policy Node. Expand the
Machine Level node.
Expand the Code Groups node. Right click on the All_Code node and
select "New..." Follow the wizard to build the new permission set (I
normally use strong name - see the .Net help for how to add a strong
name to you're solution). After you finish the wizard, you should be go
to go (on your computer at least!) So before you exit the Framework
Configuration, right click on "Runtime Security Policy" and select
"Create Deployment Package" and follow the wizard (be sure to select
Machine Level). This msi installer has to be run on each computer that
is going to use your program, and it must be run of the local drive -
running it from the network drive will not do anything. I had our
company's Network admin set up a login script to run the installer - I
think it the easiest way to accomplish it.

Let me know if that helps,

Seth Rowe
Rick wrote:
Well, I figured out part of the problem.

I'm new to VB.net and did not understand that I was Publishing the
application and clicking on the .application was installing it on the
local
computer.

However when I just copy the exe file to the file server (along with the
xml
file for db configuration) I get an unhandled exception. What should I
be
doing to get the exe to run on the server from a common location so all
clients can access it

"Rick" <Ri**@LakeValleySeed.comwrote in message
news:eV****************@TK2MSFTNGP05.phx.gbl...
I have a VB.Net 2005 application that I am publishing to a network file
server.

The app reads an xml file that has some database connection information
in
it. This xml file is located in the same folder as the executable.

The problem is when I double click on the appname.application on the
server the program can't find the xml file because the
Application.StartupPath is:

C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...

So it looks like the program is being run from the local client rather
than the file server.

Why is that happening and is there some way to find out inside the
program
where the .exe really is located?

Rick
Oct 30 '06 #5

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

Similar topics

5
by: Robert Magnusson | last post by:
Hi All, This is sure to be an easy question. I am wondering what the accepted standard is for referencing a sub-folder below the application.exe folder? In VB6 you simply used App.Path and...
5
by: Eranga | last post by:
In c# windows applicatiopns the Application.StartupPath can be used to find the path for the executable file. How can the same be found for a console application?(we can't use application because...
8
by: jcrouse | last post by:
I am trying to run a command from a command prompt using the shell command. Here is the syntax I want to execute: Shell(lblMameExePath.Text & " -listinfo >" & Application.StartupPath &...
3
by: hayworth | last post by:
I had some code to build the name of a file: ' Build the name of the XML config file. g_strFiles.strConfig = My.Computer.FileSystem.CombinePath(Application.StartupPath, "\Settings\Config...
0
by: =?Utf-8?B?Sm9iIExvdA==?= | last post by:
I am using BulkLoad from .NET application as follows SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class obj = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class(); obj.ConnectionString =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.