Skip to main content

Microsoft Silverlight

Answered Question contact formsRSS Feed

(1)

greenboi
greenboi

Member

Member

239 points

81 Posts

contact forms

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!

thanx and greetz, greenboi

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Re: contact forms

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.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

greenboi
greenboi

Member

Member

239 points

81 Posts

Re: contact forms

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.

thanx and greetz, greenboi

greenboi
greenboi

Member

Member

239 points

81 Posts

Re: Re: contact forms

 I guess it might work with XmlWriter or XDocument.

Does anybody have a code example for that?

thank you in advance

thanx and greetz, greenboi

adefwebserver
adefwebs...

Member

Member

448 points

127 Posts

Silverlight MVP
Answered Question

Re: Re: contact forms

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?

greenboi
greenboi

Member

Member

239 points

81 Posts

Re: Re: contact forms

 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.

thanx and greetz, greenboi

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft
Answered Question

Re: Re: contact forms

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

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

greenboi
greenboi

Member

Member

239 points

81 Posts

Re: contact forms

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!

thanx and greetz, greenboi

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft

Re: contact forms

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.

Best regards,

Jonathan

 

 

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

greenboi
greenboi

Member

Member

239 points

81 Posts

Re: contact forms

 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).

thanx and greetz, greenboi

mbaocha
mbaocha

Member

Member

14 points

7 Posts

Re: contact forms

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


  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities