locked
split url and us in many pages, usercontrol RRS feed

  • Question

  • Hello.

    in my application I us many <user controls> and all data are retrieved from the server. For example.

    HttpResponseMessage titleResponse = await httpClient.GetAsync("http://localhost:32000/portada/DetailTitle.php?recordID=1");

    and I would like split url. For example.

    private string TitleUrl = "http://localhost:32000/";
    HttpResponseMessage titleResponse = await httpClient.GetAsync(TitleUrl + "portada/DetailTitle.php?recordID=1");

    this example work only in one page, but I would like reuse primary address in different user controls or pages.

    I have no idea how and where to put, the code.

    Thanks a lot

    Sunday, February 2, 2014 11:14 PM

Answers

  • Hi Vizaint,

    Use internaland static?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Vizaint Monday, February 3, 2014 9:38 AM
    Monday, February 3, 2014 2:56 AM
    Moderator

All replies

  • Hi Vizaint,

    Use internaland static?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Vizaint Monday, February 3, 2014 9:38 AM
    Monday, February 3, 2014 2:56 AM
    Moderator
  • Thank You James :) is work.

    public class Util
        {
            internal static string WebUrl = "http://localhost:32000";
        }
     

    And other pages only I us

    Uri uri = new Uri(Util.WebUrl, UriKind.Absolute);
                HttpResponseMessage response = await httpClient.GetAsync(uri);

    Monday, February 3, 2014 9:38 AM