473,782 Members | 2,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.Exe cutablePath throws ArgumentExcepti on: 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(objec t sender, System.EventArg s e)
{
string str = System.Windows. Forms.Applicati on.ExecutablePa th
Response.Write( str);
}

string str = System.Windows. Forms.Applicati on.ExecutablePa th statement
throws following exception
-- System.Argument Exception: 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

[ArgumentExcepti on: Illegal characters in path.]

System.Security .Permissions.Fi leIOPermission. HasIllegalChara cters(String[]
str) +276

System.Security .Permissions.Fi leIOPermission. AddPathList(Fil eIOPermissionAc cess
access, String[] pathListOrig, Boolean checkForDuplica tes, Boolean
needFullPath, Boolean copyPathList) +88

System.Security .Permissions.Fi leIOPermission. .ctor(FileIOPer missionAccess
access, String[] pathList, Boolean checkForDuplica tes, Boolean
needFullPath) +43
System.IO.Path. GetFullPath(Str ing path) +82
System.Windows. Forms.IntSecuri ty.UnsafeGetFul lPath(String fileName)
+83
System.Windows. Forms.Applicati on.get_Executab lePath() +148
Path.WebForm1.P age_Load(Object sender, EventArgs e) in
f:\temp\path\we bform1.aspx.cs: 23
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +750

Sep 5 '06 #1
1 3171
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.Diagnost ics.Process.Get CurrentProcess( ).ProcessName

hope this helps
tim

"Thomas" <sa**********@g mail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.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(objec t sender, System.EventArg s e)
{
string str = System.Windows. Forms.Applicati on.ExecutablePa th
Response.Write( str);
}

string str = System.Windows. Forms.Applicati on.ExecutablePa th statement
throws following exception
-- System.Argument Exception: 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

[ArgumentExcepti on: Illegal characters in path.]

System.Security .Permissions.Fi leIOPermission. HasIllegalChara cters(String[]
str) +276

System.Security .Permissions.Fi leIOPermission. AddPathList(Fil eIOPermissionAc cess
access, String[] pathListOrig, Boolean checkForDuplica tes, Boolean
needFullPath, Boolean copyPathList) +88

System.Security .Permissions.Fi leIOPermission. .ctor(FileIOPer missionAccess
access, String[] pathList, Boolean checkForDuplica tes, Boolean
needFullPath) +43
System.IO.Path. GetFullPath(Str ing path) +82
System.Windows. Forms.IntSecuri ty.UnsafeGetFul lPath(String fileName)
+83
System.Windows. Forms.Applicati on.get_Executab lePath() +148
Path.WebForm1.P age_Load(Object sender, EventArgs e) in
f:\temp\path\we bform1.aspx.cs: 23
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +750

Sep 6 '06 #2

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

Similar topics

4
4609
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 following (existing) directory: d:\Sites\MySite\ And you whant to create the following:
0
1548
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 a Web app. It didn't used to do that. It doesn't seem to matter whether .Net Framework 1.1 sp1 is also installed or not.
1
2335
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 (Just like it happens in the open file dialog of MS Word) Currently, if the user enters a wild card character in the file name field, it is throwing an exception with the message "Illegal characters in path". Please let me know how to achieve the...
3
1939
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. ..... question what should I import or what prefix I should use?
10
14126
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, XmlReadMode.IgnoreSchema); DataList5.DataSource = myDataSet; DataList5.DataBind(); Also, what's the best way to return XML from a method for binding into
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 all the latin characters are converted ? character which is a illegal character for file name. If my file name is N° documento per Romà
4
6916
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 function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
3
2235
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 directory for some of the files. I have found out this is because the Application.ExecutablePath has the path of the original app and not that of the application domain. Is there any way to change this so Application.ExecutablePath returns the...
1
1998
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: Error 1 The "ResolveManifestFiles" task failed unexpectedly. System.ArgumentException: Illegal characters in path. at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String str) at
0
10308
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10076
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8964
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7486
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5375
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
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 we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.