Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2003

Tip: Looking for answers? Try searching our database.

Web service reference problems from SmartClient, someone from MS please review

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JDeats - 28 Oct 2003 18:24 GMT
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.
Chris Botha - 28 Oct 2003 22:49 GMT
I saw that Dino Chiesa from Microsoft made his daily rounds on the newsgroup
without stopping at your message, so I don't know if you will get a response
from MS.
I don't think there is a simple solution. The article below may help.
http://msdn.microsoft.com/library/en-us/dnforms/html/winforms05152003.asp?frame=true

I guess if I had to do it, I would have gone one of two ways.
(1) Embed a User Control on the ASPX page, rather than a full fledged app.
The ASPX page can stick the values into the control  and the control can pop
up the main form, etc.
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx

(2) Let the ASPX store the parameters, along with the IP address of the
request in SQL Server, and when the Smart Client hits the server for the 1st
time, get the parms from SQL Server for this IP address, etc.

Let us know what you did in the end, it will be interesting.

> I have a WinForms application that I'm trying to deploy as a
> "SmartClient" (where .exe downloads and auto launches from IE using
[quoted text clipped - 37 lines]
> 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.
JDeats - 30 Oct 2003 23:01 GMT
Chris,

Thanks for those hyperlinks, Chris Sells article on "No Touch
Deployment" was exactly what I was looking for, following his advice I
implemented a custom HttpHandler for .exe files and inside that code I
perform the needed conversion:

http://myserver/myapp.exe?name=johnage=25.config
becomes:
http://myserver/myapp.exe.config

Although that neither file actually exist, the conversion makes it
possiblE for web service calls to be made.

I contacted Microsoft developer support and they told me this was a
security feature and recommended a workaround that involved embededing
a control and performing a manual download of all the files for my app
(into a temp folder) then performing System.Diagonistics.Process
spawn... I kindly told them this would circumvent the model I was
trying to work in.

When taking a closer look at the error "XML parse error..." it appears
that this is something Microsoft could fix. When the web service call
is attempted apperently one of class library objects attempts to
locate a .config file for the current Assembly, if there isn't one,
that's usually no problem, but in the scenario I was working in the
object checking this was throwing an exception because
"myapp.exe?name=johnage=25.config" isn't a valid file name. That's my
guess anyway.

Thanks for you help.

> I saw that Dino Chiesa from Microsoft made his daily rounds on the newsgroup
> without stopping at your message, so I don't know if you will get a response
[quoted text clipped - 55 lines]
> > 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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.