473,509 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6264
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
3129
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
62652
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
3672
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
5931
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
1499
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
7344
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,...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
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...
0
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.