By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,641 Members | 1,446 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,641 IT Pros & Developers. It's quick & easy.

Application.StartupPath

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.