<p>The company where I work created this application which is core to our business and relies on the web browser to enforce certain "rules" that without them renders the application kinda useless to our customers.  Sorry about having to be circumspect, An NDA along with a host of other things prevents me from saying exactly what the application is. Essentially, JavaScript controls certain timed events (that have to be accurate down to at least the second) that make it difficult to control with ajax/postbacks etc.  </p>

<p>My question is this: how hard is it to convert an ASP.NET application to SilverLight assuming that most of the code is really C# business logic and not asp.net controls?  I just got finished listening to Deep Fried bytes and the MS people make it sounds like this really isn't that big of a deal.  Is this true for web apps, or mainly Win32 ones?  </p>

<p>I know the asp.net front end is fundamentally different from SilverLight, but there is a bunch of C# code I would like to not have to rewrite if necessary.  The replacement of the javascript code to silverlight I am assuming is trivial (i know bad assumption, but I have to start somewhere) since it deals with timed events, so I am not really concerned with that.  I need to come up with a solution on how to mitigate this problem, and I am hoping this is a middle ground between: do nothing and watch us get pounded by our clients, and rewrite the whole application in something more secure than a web page with only front end validation.  Has anyone tried to convert ASP.NET code to a SilverLight project?  </p>

[{'answer_id': 64803, 'author': 'Nate Kohari', 'author_id': 1282, 'author_profile': 'https://Stackoverflow.com/users/1282', 'pm_score': 2, 'selected': True, 'text': "<p>If the bulk of your application is on the back-end, you should still be able to keep the majority of the code intact and only replace the front-end. However, Silverlight requires an understanding of WPF, which is dramatically different than the HTML/JS that your app currently uses. I'd say if your UI is pretty thin, it should be pretty easy to port to Silverlight, but the more business logic is in the UI, the harder it will be.</p>\n"}, {'answer_id': 64846, 'author': 'Jacksonh', 'author_id': 6803, 'author_profile': 'https://Stackoverflow.com/users/6803', 'pm_score': 0, 'selected': False, 'text': "<p>How heavily do you use the class libraries, and things that might be considered 'dangerous', like pinvoke, file system access and System.Diagnostics.Process?  </p>\n"}, {'answer_id': 67609, 'author': 'Jonas Follesø', 'author_id': 1199387, 'author_profile': 'https://Stackoverflow.com/users/1199387', 'pm_score': 0, 'selected': False, 'text': '<p>Porting code from ASP.NET to Silverlight is not an easy task. As Nate points outs it depends on how much of ASP.NET application is AJAX based, and how much is based around server controls. </p>\n\n<p>Silverlight is a state full client side technology, meaning everything is running on the client inside the browser. ASP.NET is a server technology, and is built around a request/response model. Since these two are completely different paradigms it\'s not a straight port.</p>\n\n<p>However, since ASP.NET is just HTML and HTTP POST of form data people have done experiments where they have added a Silverlight application directly on top of an ASP.NET page, and manually built the HTTP POST request by hand sending back the exact data the ASP.NET application work. It\'s almost like doing "screen scraping" for your own application. This could work, but wouldn\'t be optimal. You wouldn\'t get a performance increase as your ASP.NET application would have to go through a full page cycle on every request.</p>\n\n<p>A better alternative is to start out wrapping any functionality the user has in the APS.NET application as web services. You can add these services alongside your ASPX pages, and gradually port the application over. The UI you would build from the ground up based on these services.</p>\n\n<p>Good luck!</p>\n'}]
['https://Stackoverflow.com/questions/64575', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1942/']