J
JDeats
I have a WinForms application that I'm trying to deploy as a
"SmartClient" (where .exe downloads and auto launches from IE using
..NET IEExec process).
Part of my criteria for the app is to be able to get to pass
parameters into it. I found a way to do this though the
Environment.GetCommandLineArgs(); method call and passing in
attributes just as I would with an ASP or ASP.NET page (e.g.
http://myserver/myapp.exe?name=jdeats&age=27)I couldn't find this
documented anywhere, but it does work. The call to
Environment.GetCommandLineArgs() returns a string array with two
elements. The first element points to the location of IExec.exe, the
second element has the full URL with my parameters and a session
hashcode appended to the end, it looks something like this
http://myserver/myapp.exe?name=jdeats&age=27#1FB539C2A00E4E1C8...
This seemed to be consistent, so I wrote a method to parse out the
name/value pairs from the parameter list and proceeded to call
System.Web.HttpUtility.UrlDecode() on each of them.
This approach worked well until I added a Web Reference to my project,
anytime I attempt to call a web service from my app it fails if
parameters (e.g. ?name=jdeats&age=27) have been passed in. The error
message is as follows:
"Error loading XML file
http://myserver/myapp.exe?name=jdeatsage=27.config. There is an
invalid character in the given encoding"
Note that: no where in the code am I attempting to load a .config file
of any sort, an app.config has never been added to the project. The
Web Reference is set to "Static", yet some method call (I presume an
internal Microsoft method) has converted:
"http://myserver/myapp.exe?name=jdeats&age=27 into
"http://myserver/myapp.exe?name=jdeatsage=27.config".
With the more params I attempt to add, it's always the same. '&'
characters are stripped away and a ".config" is concatenated on to the
end. As a result of this the web service call can not be made. I'd
like to know if this is a bug or is it a by-design behavior. If it's
by-design what are my work around options.
"SmartClient" (where .exe downloads and auto launches from IE using
..NET IEExec process).
Part of my criteria for the app is to be able to get to pass
parameters into it. I found a way to do this though the
Environment.GetCommandLineArgs(); method call and passing in
attributes just as I would with an ASP or ASP.NET page (e.g.
http://myserver/myapp.exe?name=jdeats&age=27)I couldn't find this
documented anywhere, but it does work. The call to
Environment.GetCommandLineArgs() returns a string array with two
elements. The first element points to the location of IExec.exe, the
second element has the full URL with my parameters and a session
hashcode appended to the end, it looks something like this
http://myserver/myapp.exe?name=jdeats&age=27#1FB539C2A00E4E1C8...
This seemed to be consistent, so I wrote a method to parse out the
name/value pairs from the parameter list and proceeded to call
System.Web.HttpUtility.UrlDecode() on each of them.
This approach worked well until I added a Web Reference to my project,
anytime I attempt to call a web service from my app it fails if
parameters (e.g. ?name=jdeats&age=27) have been passed in. The error
message is as follows:
"Error loading XML file
http://myserver/myapp.exe?name=jdeatsage=27.config. There is an
invalid character in the given encoding"
Note that: no where in the code am I attempting to load a .config file
of any sort, an app.config has never been added to the project. The
Web Reference is set to "Static", yet some method call (I presume an
internal Microsoft method) has converted:
"http://myserver/myapp.exe?name=jdeats&age=27 into
"http://myserver/myapp.exe?name=jdeatsage=27.config".
With the more params I attempt to add, it's always the same. '&'
characters are stripped away and a ".config" is concatenated on to the
end. As a result of this the web service call can not be made. I'd
like to know if this is a bug or is it a by-design behavior. If it's
by-design what are my work around options.