473,732 Members | 2,201 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 3165
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
4606
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
1546
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
2334
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
1935
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
14122
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
6913
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
2233
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
1996
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
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9447
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
9235
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,...
1
6735
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
6031
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
4550
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
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.