473,507 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.ExecutablePath throws ArgumentException: Illegal characters in path.]

Hi,

I have written a simple web application in asp.net 1.1.4322. following
is the code written in Page_Load

private void Page_Load(object sender, System.EventArgs e)
{
string str = System.Windows.Forms.Application.ExecutablePath
Response.Write(str);
}

string str = System.Windows.Forms.Application.ExecutablePath statement
throws following exception
-- System.ArgumentException: Illegal characters in path

What could be the reason behind this? This method is used in our web
application to get the calling applications name (aspnet_wp or
w3wp.exe).
Please help as this need to be resolved as soon as possible.

Stack trace Detail

[ArgumentException: Illegal characters in path.]

System.Security.Permissions.FileIOPermission.HasIl legalCharacters(String[]
str) +276

System.Security.Permissions.FileIOPermission.AddPa thList(FileIOPermissionAccess
access, String[] pathListOrig, Boolean checkForDuplicates, Boolean
needFullPath, Boolean copyPathList) +88

System.Security.Permissions.FileIOPermission..ctor (FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean
needFullPath) +43
System.IO.Path.GetFullPath(String path) +82
System.Windows.Forms.IntSecurity.UnsafeGetFullPath (String fileName)
+83
System.Windows.Forms.Application.get_ExecutablePat h() +148
Path.WebForm1.Page_Load(Object sender, EventArgs e) in
f:\temp\path\webform1.aspx.cs:23
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Sep 5 '06 #1
1 3150
i don't really like the idea of using a property designed for Windows Forms
in an Asp.Net web application, not surprised it bails out on you! this
should give you the info you want:
System.Diagnostics.Process.GetCurrentProcess().Pro cessName

hope this helps
tim

"Thomas" <sa**********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi,

I have written a simple web application in asp.net 1.1.4322. following
is the code written in Page_Load

private void Page_Load(object sender, System.EventArgs e)
{
string str = System.Windows.Forms.Application.ExecutablePath
Response.Write(str);
}

string str = System.Windows.Forms.Application.ExecutablePath statement
throws following exception
-- System.ArgumentException: Illegal characters in path

What could be the reason behind this? This method is used in our web
application to get the calling applications name (aspnet_wp or
w3wp.exe).
Please help as this need to be resolved as soon as possible.

Stack trace Detail

[ArgumentException: Illegal characters in path.]

System.Security.Permissions.FileIOPermission.HasIl legalCharacters(String[]
str) +276

System.Security.Permissions.FileIOPermission.AddPa thList(FileIOPermissionAccess
access, String[] pathListOrig, Boolean checkForDuplicates, Boolean
needFullPath, Boolean copyPathList) +88

System.Security.Permissions.FileIOPermission..ctor (FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean
needFullPath) +43
System.IO.Path.GetFullPath(String path) +82
System.Windows.Forms.IntSecurity.UnsafeGetFullPath (String fileName)
+83
System.Windows.Forms.Application.get_ExecutablePat h() +148
Path.WebForm1.Page_Load(Object sender, EventArgs e) in
f:\temp\path\webform1.aspx.cs:23
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Sep 6 '06 #2

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

Similar topics

4
4579
by: Frederico Caldeira Knabben | last post by:
Hello, I'm having a problem when trying to use the Directory.CreateDirectory() method. It throws a DirectoryNotFoundException exception. I'll try to illustrate it: Suppose you have the...
0
1540
by: Tim Fitzgerald | last post by:
Just a heads up. While testing a .Net Web application on system on which XP SP2 has been loaded, we found that the Application.ExecutablePath property throws an ArgumentException when called from...
1
2313
by: Shilpa | last post by:
Hi, I have a OpenFileDialog on my windows form whose filter is *.*. I want the users to be able to further filter the files by giving *.doc or *.zip etc in the "file name" field of the dialog...
3
1918
by: gs | last post by:
I do want the path and the filename of the executable. However, visual studio .net basic express 2005 rejects Application.ExecutablePath Error 1 Name 'Application' is not declared. ..... ...
10
14088
by: webmaster | last post by:
Getting error: Illegal characters in path what's wrong with this? string xmlSR = "<XmlDS><table1><phone>Value1</phone><name>jake</name></table1></XmlDS>"; myDataSet.ReadXml(xmlSR,...
3
3026
by: =?Utf-8?B?SG9seXNtb2tl?= | last post by:
Hi there, I am having a problem im my webservices method when trying to save a file with latin characters to disk passed through WSE. I have noticed that when trying to read the file name from...
4
6876
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
3
2224
by: Olie | last post by:
I am trying to run an application by creating a new AppDomain and then running the executable in the new domain. This works perfectly but when the application runs it is looking in the wrong...
1
1964
by: DR | last post by:
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: ...
0
7111
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
7319
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
7376
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
7485
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...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
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 ...
0
412
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.