Silverlight 3 and RIA Service – Creating a Proxy for Cross Domain HttpRequests

One of the first things I thought about after writing my first two articles on RIA Services (Basic and Advanced) was how I could take advantage of this new technology.

The first thing I could thing of was a solution that helps overcoming the Cross Domain Issues when accessing resources on the internet. What about something like a proxy service to overcome cross domain issues? Access our known proxy server which will forward the request to the actual resource on the internet.


Let’s first define the interface to communicate through. A very simple ProxyRequest that contains the resource to access on the ‘Any resource’ side, and an Id to make sure we can correctly associate the Request and the Response later on.

namespace MM.Ria.CrossDomainProxy
    public class ProxyRequest
        public Guid Id { get; set; }

        public string Url { get; set; }

The ProxyResponse is very simple as well. Almost the same as the ProxyRequest a RequestId associated with the Id in the ProxyRequest, the Content and of course something to store any error that occurred.

namespace MM.Ria.CrossDomainProxy
    public class ProxyResponse
        public Guid RequestId { get; set; }

        public string Content { get; set; }

        public string Error { get; set; }

And we need an Interface with an Operation, let’s call it process.

namespace MM.Ria.CrossDomainProxy
    public interface IProxy
        ProxyResponse Process(ProxyRequest request);

We now create the RIA Service implementation, by just delegating everything to a RegularProxy implementation. So this one is simple as well.

namespace MM.Ria.CrossDomainProxy
    public class DomainProxy : DomainService, IProxy
        private readonly RegularProxy m_proxy = new RegularProxy();

        public ProxyResponse Process(ProxyRequest request)
            return m_proxy.Process(request);

And the magic is in the RegularProxy, don’t think we should call it magic though. Just an usage of the WebClient class to download the data from the Url.

namespace MM.Ria.CrossDomainProxy
    public class RegularProxy : IProxy
        public ProxyResponse Process(ProxyRequest request)
            var response = new ProxyResponse {RequestId = request.Id};
                using (var client = new WebClient())
                    string data = client.DownloadString(request.Url);
                    response.Content = data;
            catch (Exception exception)
                response.Error = exception.Message;

            return response;

Don’t forget this is a very basic Proxy implementation and doesn’t implement all the features we can think of. But this first basic set up can easily be enhanced with for example Credentials support, Caching and other things as well.

But how can we use it in our Silverlight application? Simple as well.

var domainProxy = new DomainProxy();
domainProxy.ProcessCompleted += (sender, e) => Debug.WriteLine((e.ReturnValue as ProxyResponse).Content);
domainProxy.Process(new ProxyRequest
                            Id = Guid.NewGuid(), 
                            Url = ""

Looks like the keyword is simple when we’re creating RIA Services. I really like it.

Ps. This article is cross posted on: Mark Monster’s blog and Silverlight Help.

  • Gravatar Joe May 19th, 2011 at 14:08

    Do you have a sample porject/solution implemnting this RIA Service Proxy from cross domain requests that I could download and look at.

  • Gravatar Ripped Muscle does it work June 29th, 2014 at 22:00
    Excellent beat ! I would like to apprentice while you amend your site, how could i
    subscribe for a blog site? The account helped me a acceptable deal.
    I had bbeen tiny bit acquainted of this your broadcast
    offered bright clear concept
  • Gravatar instagram followers July 22nd, 2014 at 13:37
    Really when someone doesn't be aware of afterward its up to other visitors that they will assist, so here it happens.
  • Gravatar hd film izleme August 8th, 2014 at 11:26
    The film is set in an alternate reality in which Japan has emerged from World War II as a totalitarian society.
    If you have been giving your followers great information, when they need your services, they will trust you as an authority and often request
    to engage your products and services. The romantic movie is a story
    about how Harman Baweja has just ten days to win over the love of his life, Priyanka
  • Gravatar Teknoloji August 13th, 2014 at 16:08
    In a frank interview with GQ Magazine, Fox said that she fell in love with a female stripper
    when she was eighteen and used the experience to illustrate her belief that all humans are born with the ability to be
    attracted to both sexes. * Browse the evaluations of
    video-on-demands and fee the help. De Dana Dhan is a story
    of two broke guys who are in search of big money, to prove a point to their girlfriends.
  • Gravatar cheap trade show display panels September 2nd, 2014 at 06:08
    No appear the objective, ensure all folks are on the same
    page so the design notion of the trade exhibition booth, and also the staff working in the booth, declares a tight message to visitors.
    Becoming an excellent designer requires you to think like one and have all of the tools
    any particular one would use. If your client had to purchase a display, it might either
    should be a one-size-fits-all model, or they could have to purchase a number of different sized exhibits.
  • Gravatar india tours packages September 6th, 2014 at 02:44
    You must get a detailed travel guide of India and
    look about the places you are likely to visit in India ahead of time only.
    Visit to God's own land as Kerala is popularly called, is gaining popularity among the visitors especially for the
    backwaters of Alleppey and Kochi and exotic sea beaches in Kovalam, Varkala and Poovar.
    Guests can also enjoy on-board massage centers,
    gyms, and sweetness parlors, as well as, bars and restaurants that
    offer exquisite cuisine to your culinary indulgence.
  • Gravatar youtube September 19th, 2014 at 15:53
    May I just say what a relief to find somebody who really understands
    what they are talking about over the internet.

    You definitely realize how to bring a problem to light and
    make it important. More and more people need to read this and understand
    this side of the story. I was surprised that you're not more popular because you most certainly have the gift.
  • Gravatar x x x September 21st, 2014 at 02:52
    I was curious if you ever considered changing the structure of your site?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or two images.
    Maybe you could space it out better?
  • Gravatar what is cologne September 21st, 2014 at 04:35
    Nice post. I was checking constantly this blog and I'm
    impressed! Very helpful information specifically the last part :) I care for such info much.
    I was looking for this particular information for a long time.

    Thank you and good luck.
  • Gravatar Tamika September 22nd, 2014 at 08:25
    Hey! This is kind of off topic but I need some advice from an established blog.
    Is it hard to set up your own blog? I'm not very techincal but
    I can figure things out pretty quick. I'm thinking
    about creating my own but I'm not sure where to begin. Do you have any tips or suggestions?
    Thank you
  • Gravatar twitter September 24th, 2014 at 11:30
    I think this is one of the most vital info for me.
    And i am glad reading your article. But wanna remark on few general things, The site style is wonderful, the articles is really nice
    : D. Good job, cheers. twitter
  • Gravatar twitter September 25th, 2014 at 03:13
    My partner and I absolutely love your blog and find the majority of your post's
    to be just what I'm looking for. Would you offer
    guest writers to write content for yourself? I wouldn't mind creating a post
    or elaborating on most of the subjects you write about here.
    Again, awesome blog! twitter
  • Gravatar instagram September 28th, 2014 at 03:36
    Quality articles or reviews is the important to attract the viewers to visit the web site, that's what this website is providing.
  • Gravatar instagram September 29th, 2014 at 14:17
    What's up to all, it's truly a fastidious for me to pay a quick visit this
    web site, it includes valuable Information. instagram
  • Gravatar mulberry email November 1st, 2014 at 01:50
    One other issue is that if you are in a circumstances where you would not have a cosigner then you may really want to try to exhaust all of your educational funding options. You'll find many funds and other grants that will offer you finances to help you with school expenses. Thanks a lot for the post.
    mulberry email
  • Gravatar mulberry bayswater bags November 3rd, 2014 at 06:35
    One other thing is that an online business administration program is designed for people to be able to effortlessly proceed to bachelor degree programs. The 90 credit diploma meets the lower bachelor college degree requirements and once you earn the associate of arts in BA online, you may have access to the modern technologies in this particular field. Some reasons why students want to get their associate degree in business is because they are interested in this area and want to obtain the general education necessary ahead of jumping right into a bachelor diploma program. Thanks for the tips you provide with your blog.
    mulberry bayswater bags
  • Gravatar prix polo timberland November 4th, 2014 at 12:28
    Simply desire to say your article is as surprising. The clarity in your put up is just cool and that i can assume you are a professional on this subject. Well along with your permission allow me to grab your feed to stay up to date with coming near near post. Thank you one million and please carry on the gratifying work.
  • By wearing replica watches they could give in on their desires and yet not burn an excessive amount of money. There isn't chance of being solaced and disappointed through the Replica watches as they'll surely offer you more than everything you expected. This can also be one of the best selling and credit giving types of Replica watches. This suggests that as an alternative of marking each second, the other hand moves swiftly into a number of ticks very well. The exhausted versions in the Pasha will be in 18 carat craven gold, rose gold, stainless-steel, and they are bogus both in men's and some women's models.
  • He had three ships manned with 110 sailors and 2 native boys. As for designer watches, Cartier is likely one from the most well-liked manufacturers about. The dials may also be big and the metal can also be selected by the manufacturer remembering the sports look and attitude. 'Do you wish to get your admired and fashionable watches with lower price'. Somebody deciding on to hold the feedback unfavorable also indicates that there is something to conceal and that is not very good information possibly.
  • The Options For No-Hassle cartier watches replica ProgramsOne particular of the oldest jewelers in the world, accouterment on the whims of potential and cine stars alike, Cartier enjoys a acceptability for affairs by yourself the best superior adornment and accessories.
  • Through January 2, 2012, experience the joy of Christmas with performances by the world-famous Rockettes, that may be performed in '3DLive' to the first time this season. The other difference is within the quality of manufacture. For those significant quality imitations, the see gurus cannot spot them out through the initial glance. and this rightly proved when you are changing your personality for your better with Replica Tag Heuer watches. I must let you know that buying replica products will be as great as buying a lavishing one and tag Heuer is one from the best instances of it.
  • Gravatar francois charger indicator smartphones December 9th, 2014 at 06:29
    Thanks for sharing your thoughts about other.
  • Gravatar instagram January 14th, 2015 at 11:53
    What i don't understood is actually how you are no longer actually much more smartly-appreciated than you might be right now.

    You are very intelligent. You understand therefore considerably when it comes to this matter, made me
    for my part believe it from numerous various angles. Its like men and women aren't interested unless it is something
    to accomplish with Woman gaga! Your own stuffs outstanding.
    At all times care for it up! instagram
  • Gravatar Heidi January 29th, 2015 at 14:04
    whoah this blog is excellent i really like reading your posts.
    Keep up the good work! You realize, many people are hunting round for this
    info, you could help them greatly.
  • Gravatar instagram January 31st, 2015 at 02:55
    Very good post. I certainly love this site. Thanks!
  • Gravatar instagram March 7th, 2015 at 06:43
    What i do not understood is in truth how you're now not really much more well-appreciated than you may be
    now. You are very intelligent. You already know therefore significantly on the subject of this subject,
    produced me for my part believe it from a lot of varied angles.
    Its like men and women don't seem to be fascinated until it's one thing to
    do with Lady gaga! Your personal stuffs outstanding.
    All the time deal with it up! instagram
  • Some of them will require you to be pre-approved
    for a home loan from your local lender. Try calling local housing
    agencies and ask about the available home loan programs. If you don't understand a term or any of the jargon involved in real estate, then by all means ask your
    lender or broker for clarification. However, the county has changed the rules to allow
    potential homebuyers to find a foreclosed home anywhere within the Travis County border.
    Secretary Donovan said that no one is looking into the homebuyer tax credit
    at this time. These can include electrical and structural issues.
  • Gravatar seo March 23rd, 2015 at 05:41
    Remember, there are many to choose from and the best are those geared toward assisting low
    to medium income families by offering smaller down payments,
    no down payments, lowered closing costs and reduced
    interest rates. I was able to stay away and do traditional, conventional type financing for people.

    The United States of America is becoming crowded – with real estate
    companies, firms and other establishments.
    However, the county has changed the rules to allow potential homebuyers
    to find a foreclosed home anywhere within the Travis
    County border. Your debt ratios can also be specific,
    based upon on the state he could be residing in. Prices are
    just about as low as they are going to go, mortgage money is cheap, and government incentive programs are still in place
    - at least for the time being - that make it the best time for buying a home that a Chicago first time home buyer is likely ever going
    to see.
  • Gravatar highgate restaurants May 3rd, 2015 at 20:43
    This tax is applied at a rate of 1% of the first $200,000 purchase price, and 2%
    of every dollar thereafter. Some down payment assistance organizations have a list of homes for sale from which the
    buyer may choose to own a home. Nehemiah Program, Ameri - Dream, Partners
    In Charity, Homes For All Programs. The upsells are also
    far cheaper than the actual cost of the phone.
    There are often many tax write offs associated with owning a home, including mortgage interest, and property taxes.

    These can include electrical and structural issues.
  • Gravatar June 10th, 2015 at 04:18
    Point here: Both are capable of hurting each other, if
    you value your relationship be aware of your actions.
    I was able to stay away and do traditional, conventional type financing
    for people. 'With 175 reservations made in the program's first 14 days, it's truly gratifying to see this
    program help real people realize their dream of home ownership, helping
    them to build a better future and leading to a stronger overall
    economy in Illinois. There are two kinds of home improvement loans
    available to choose from. There are often many tax write offs associated with owning a home, including mortgage interest, and property taxes.
    They are willing to pay all of your closing costs in almost every
    case and if there are some repairs that need to be done then they
    are willing to do those again in almost every case.
  • Gravatar All About Unique News And Lifestyle June 19th, 2015 at 23:25
    In 2007, the Iranian state pulled in $57 billion in oil export revenue, comprising about half of all governmental revenue.
    With only 70 grams of weight that has been constricted firmly in the measurement
    of 103. Moreover, you should be well aware of everything you are going to purchase otherwise there would be a chance that you may get confused and purchase an item that
    is not required. When you are going to shopping for a pet cot, you need
    to consider so many things.
  • Gravatar ALL ABOUT FASHION AND CLOTHES June 23rd, 2015 at 03:06
    Also, discounted designer clothes are often old models or
    styles that have been in the rack for a long time.
    Even girls spend a lot of time in hunting for the branded and designer
    shoe that would perfectly match with their outfits.
    There are a lot of styles to choose from and you can't really go wrong as long as you don't
    hang on to those ones you got back at the beginning of the craze when they were ultra chunky.
    However, you want to ensure that your purse or handbag matches any other bags
    that you are carrying.
  • Gravatar Julianel August 9th, 2015 at 10:21
    Zofran And Compazine Ve Tattoo On Accutane Heard Tylenol Cold And Flu Pregnant [url= ]Zolpidem Tartrate Blood Pressure Ambien Cr[/url]. Paroxetine Shrooms Purpose Of Metoprolol Anxiety Topamax Impotence Online Clomid X26c Multiple Births . Lexapro And First Trimester Lipitor Shortness Of Breath Atorvastatin . Advil And Plavix Prescription Celexa From Canadian Pharmacy [url= ]xanax online doctor[/url] Renagel Roxane Order Zovirax cod next day. Zovirax Acyclovir 800 Mg Zovir NO. What Are Propranolol Migraine Prevention Urinary Tract Infection Treatment Cipro Trimethoprim Sulfamethoxazole
  • Gravatar DC SEO August 20th, 2015 at 00:02
    Using SWOT Analysis as a tool to formulate Strategy is one
    of the most effective tool in Strategic Planning. The reliability of the company will
    help you to have an extensive analysis to your site.
    There are more than 1 million people who use internet and more than 90%
    of the users employ search engines to avail information. So, you
    have to think it over because the positive result could make your investment worthwhile.
  • Gravatar September 19th, 2015 at 23:35
    Remember, there are many to choose from and the best are those geared toward assisting low to medium
    income families by offering smaller down payments, no down payments, lowered closing costs
    and reduced interest rates. Be sure to check the
    contract details on any grant or loan you're thinking about applying for, to prevent you
    from running into real financial trouble later.
    After 1999, getting the loan has definitely become quite easy and one will definitely find that buying and selling through the
    first time buyer home loans has become very easy as well since majority of such schemes are for the welfare
    of the common people. Regardless, the eligibility is basically as
    stated above, and entitles you to save $750 on your taxes.
    Did you know that under most first time home buyer programs that single parents are AUTOMATICALLY
    considered first time home buyers. And, when you apply for home finance solutions,
     lenders ascertain your financial condition by taking a look at your income.
  • Gravatar Dannielle October 31st, 2015 at 20:49
    This tax is applied at a rate of 1% of the first $200,000 purchase price, and 2% of
    every dollar thereafter. Some down payment assistance organizations have a list
    of homes for sale from which the buyer may choose to own a
    home. After 1999, getting the loan has definitely become
    quite easy and one will definitely find that buying
    and selling through the first time buyer home loans has become very easy as well since majority of such schemes are for the welfare of the common people.
    An FHA loan is much more forgiving of a limited
    credit history than conventional loans. According to Nicole Larrimore
    of Nevada Rural Housing (NRHA), 'We're hoping funds will last for several years.
    Then go to a 1st time home buyers program so that they can get you down payment assistance funds which will lower your
    mortgage even greater.
  • Gravatar erotica November 7th, 2015 at 09:11
    Hi it's me, I am also visiting this web site daily, this web site is actually good and
    the visitors are in fact sharing pleasant thoughts.
  • Gravatar bajar de peso grasa corporal November 18th, 2015 at 13:46
    Hacer dieta y la limitación de la ingesta de alimentos
    por contar calorías prácticamente nunca marcha.
  • Gravatar Http:// December 4th, 2015 at 07:43
    I think that what you posted made a ton of sense.
    But, think about this, suppose you were to create a killer headline?
    I ain't saying your content isn't good., however suppose you added a title that grabbed people's attention? I mean Silverlight 3 and RIA Service
    – Creating a Proxy for Cross Domain HttpRequests - Silverlight, WP7, .NET, C#, ASP.NET MVC is
    kinda vanilla. You could glance at Yahoo's home page and
    note how they create post headlines to get viewers interested.
    You might try adding a video or a picture or two to grab readers interested about everything've got to say.
    Just my opinion, it might make your posts a little livelier.
  • Gravatar Ugg Scontati On Line December 17th, 2015 at 18:41
    mcm rucksack

    <a href="" >Ugg Scontati On Line</a>
  • Gravatar Stivali Ugg Estivi December 17th, 2015 at 19:01
    nike air max all
    Stivali Ugg Estivi
  • Gravatar Stivali Ugg Scontati December 17th, 2015 at 19:19
    mcm elctronics
    Stivali Ugg Scontati
  • Gravatar Ugg Grigi Bassi February 12th, 2016 at 04:27
    nike air max motor
    Ugg Grigi Bassi
  • Gravatar Mens Mcm Bags February 17th, 2016 at 13:35
    nike free run sale free shipping

    Mens Mcm Bags
  • Gravatar Mcm Electronics Coupons February 19th, 2016 at 22:33
    nike 2011

    Mcm Electronics Coupons
  • Gravatar Mcm First Lady February 20th, 2016 at 22:07
    shoes like nike air max

    Mcm First Lady
  • Gravatar Mcm Electronics Coupon February 20th, 2016 at 22:24
    nike shoe online
    Mcm Electronics Coupon
  • Gravatar Ugg Europa February 22nd, 2016 at 01:45
    nike cheap shoes
    Ugg Europa
  • Gravatar Mcm Bags Women February 22nd, 2016 at 06:55
    cheap nike air max 1
    Mcm Bags Women
  • Gravatar Mcm Con February 23rd, 2016 at 06:02
    mcm sneakers for cheap
    Mcm Con
  • Gravatar What Is Mcm Bags February 25th, 2016 at 12:29
    nike jordan outlet sale
    What Is Mcm Bags
  • Gravatar Mcm Boston Bag February 26th, 2016 at 17:57
    nike air air max 90

    Mcm Boston Bag
  • Gravatar Blair June 5th, 2016 at 06:24
    You can definitely see your enthusiasm in the work you write.
    The sector hopes for even more passionate writers like you who aren't afraid
    to say how they believe. Always follow your heart.
  • Gravatar Brayden August 30th, 2016 at 23:46
    Hmmm it appears like your blog ate my first comment (it was extremely long) so I guyess I'll just sum it upp what I
    had writte and say, I'm thoroughly enjoying your blog. I as well am
    aan aspiring blog blogger but I'm still new to the whple thing.

    Do you have any recommendations for beginner blog writers?

    I'd definitely appreciate it.
  • Gravatar September 16th, 2016 at 17:46
    I am curious to fond out what blog platform you happen to be utilizing?

    I'm experiencing somee minor security problems with my latest website and
    I'd like to find sometfhing molre safeguarded. Do you have any recommendations?