Skip to main content
Home Forums Silverlight Programming Programming with .NET - General contact forms
10 replies. Latest Post by mbaocha on May 19, 2009.
(1)
greenboi
Member
239 points
81 Posts
02-14-2009 9:14 AM |
Hello, I have a silverlight application with a contact form on it. The user enters his name, email, and message. He can also choose to be put on a mailing list. Upon Clicking submit, I need somehow get the content the user entered. This could envolve writing a file (txt or xml) to the server, sending an email, using a web service, or anything else - I just need to see a list of who used the form, their email, and their comments.
I would be realy happy for the easyest possible solution (my app is quite complicated enough).
Thank You!
bryant
Star
9937 points
1,629 Posts
02-14-2009 10:20 AM |
Which is easiest depends on what server technology is hosting your site and what you're comfortable with. Personally, I think a web service would be the easiest.
02-14-2009 2:20 PM |
the website is hosted on silverlight streaming and embedded in a free 0$ (doteasy) html page. (I don't know if I have to use silverlight streaming... I have 100mb free space on doteasy but i don't know if I am allowed to add a new mime type - xap)
I am a web service newbe so i would need a few code snippets to get going.
Thanks anyway.
02-15-2009 4:37 AM |
I guess it might work with XmlWriter or XDocument.
Does anybody have a code example for that?
thank you in advance
adefwebs...
448 points
127 Posts
02-15-2009 12:36 PM |
As far as I know, the only way to get any output from Silverlight is:
So it appears to "get" any information from the user you need a program that will retrieve the information through Network Communication or get the HTML Bridge to perform a Form post of the information to your server.
However, you will still need some sort of scripting language that will receive the information. Do you have any scripting capabilities with your web hosting?
02-17-2009 3:20 PM |
thanks for your answer, but I have a few problems: I have no network communication knowledge (yet). Isolated storage is not an option, because I don't need the information on the client side, this is supposed to be a way for users to submit questions, feedback and requests. as I mentioned earlier, they have also got the possibility to join a mailing list.
this leaves scripts. I have just about no scripting abilities (I am talking about my person), and I don't think that a 0 dollar hosting plan will provide lots of capabilities.
but still I think there should be an easy way to write a few lines of text and get them on the web server.
I guess I would be quite quick to pick up on web services etc. if i got some examples (i am just about to look into your web service link on msn code gallery.
thank you.
Jonathan...
All-Star
24939 points
2,425 Posts
02-19-2009 10:31 PM |
Hi Greenboi,
Isolated Storage will store the information on client. This functionality is usually used to store personal information or settings on client. In your condition, we need to store the entered information to server. As Silverlight runs on client, we cannot post back as a normal ASP.NET page. Therefore, we need to have a WebService. How to call WebService a Silverlight application, please reference to this video tutorial.
Best regards,
Jonahtan
02-20-2009 11:46 AM |
thanks for your anwswer - it goes in the right direction.
but how do I use a WCF or ASPX web service to write stuff to the server? In the video, the web services just execute some code on the server in order to post info back into the silverlight application to display it there. but I don't need to send information from the server to the client! its the other way around!
So how do I use a web service to save a simple xml or even txt file on the server? something like using the using streamWriter statement in desktop apps, only not writing on the client side but adding new lines of text or xml to a server side file.
and also, a new question has arisen: will the web services work if I host the website on Silverlight Streaming?
Thank You a lot anyway!
02-23-2009 1:42 AM |
Hi GreenBoi,
greenboi:n the video, the web services just execute some code on the server in order to post info back into the silverlight application to display it there. but I don't need to send information from the server to the client! its the other way around!
When we can the WCF method, we can pass a object. Therefore, we'd better create an ojbect. For example, FormData. Assume you want to post back name and address back to server.
[DataContract] public class FormData { [DataMember] public string Name; [DataMember] public string Address; }
Now can create the FormData instance. For example,
FormData fd = new FormData();
fd. Name = txtName.Text;
fd.Address = txtAddress.Text;
Send data back
WCFSimpleSample.WCFServiceTestClient proxy = new WCFTest.WCFSimpleSample.WCFServiceTestClient(); proxy.SayHelloCompleted += new EventHandler<WCFTest.WCFSimpleSample.SayHelloCompletedEventArgs>(proxy_SayHelloCompleted); proxy.SayHelloAsync(fd );
Get the Data on server side.
public bool SayHello(FormData fd) { //get the fd;
return true or false }
greenboi:So how do I use a web service to save a simple xml or even txt file on the server? something like using the using streamWriter statement in desktop apps, only not writing on the client side but adding new lines of text or xml to a server side file.
Just like you do it on a normal asp.net page, we'd use XmlWriter.
greenboi:and also, a new question has arisen: will the web services work if I host the website on Silverlight Streaming?
Yes.
Jonathan
02-24-2009 12:40 PM |
thanks for your help jonathan.
I do have to ask another question though: how can I write XML data from an app hosted on silverlight streaming onto a different (ftp) webserver? that would mean cross-domain access (I don't know If and how to allow it, and I also don't want every website on sl streaming to have access).
mbaocha
14 points
7 Posts
05-19-2009 10:19 AM |
which version of iis are you using. what version of dot net framework are you using. these stuffs maters in deciding which way to go.
________________________ Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}
Cheap Affordable Web Hosting | Web Hosting Nigeria | Best Web Design Company