Collected

Home

Create collection

Browse collections

Join Collected


Username


Password


Forgot your password?


linq

A collection of:

my code   

By:

revanth   

Visits:

20,462   

View:

 
1 favorites | Add to favorites |

How to get the network user ID in intranet site?


All Forums 22 May 2012, 2:53 am CEST

Hi guys,

I've tried so many combinations, but I can't simply get the user name. What settings should I use in IIS and web.config to achieve this?

Basically I've created a simple web site that should sends an email, but the email address will be coming from the database based on the user's network login to that terminal server. Since I can't get the right value, I've simulated what is actually being extracted when the page loads. So in a test listbox I've added this:

ListBox1.Items.Add("Identity: " + HttpContext.Current.User.Identity);

ListBox1.Items.Add("Identity Name: " + HttpContext.Current.User.Identity.Name);

ListBox1.Items.Add("User Name: " + Environment.UserName);

ListBox1.Items.Add("Windows Identity name: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);

ListBox1.Items.Add("Page identity: "+ Page.User.Identity.Name);

AND THE OUTPUT I"M GETTTING...

 Identity Name: System.Security.Principal.WindowsIdentity

Identity Name: [empty string here]

User Name: IUSR

Windows Identity name: NT AUTHORITYIUSR

Page Identity: [empty string here]

Also, some of these work in my machine using local host, but when deployed in the intranet, those are the output. Any ideas please?

 Just want to add that my website's setting in IIS are: Allow all users under .Net Authorization rules; Anonymous Authentication and ASP.NET Impersonation are enabled under Authentication; In the file web.config, Authentication mode is "Windows".

System.Data.SqlClient.SqlException: Incorrect syntax near 'Reviews'.


All Forums 22 May 2012, 2:53 am CEST

 

ok i have no clue why i am getting this error.  i am simply trying to take some data entered into three different text boxes and upload it to a database once the submit button is clicked.  see below for my code sample and the error .  thank you in advance for any help you may be.  also if you see anything  i have wrong besides the error please let me know . 

 

thank you!

 

      public static SqlConnection SaveCustomerReview
        {
            get
            {
                // This property returns a new SQLConnection object when needed
                return new SqlConnection(@"Data Source=Namecustomers.db.1234567.hostedresource.com; Initial Catalog=Namecustomers; User ID=MYNAMEcustomers; Password='password1'");
            }
        }


        public static void SaveCustomerreview(string Name, string Subject, string Details)
        {
            // Add your data access code here
            string Sql;
            Sql = "INSERT INTO Customer Reviews(Name, Subject, Details) VALUES (@Name, @Subject, @Details)";
            SqlCommand command = new SqlCommand(Sql, SaveCustomerReview);

            command.Parameters.AddWithValue("@Name", Name);
            command.Parameters.AddWithValue("@Subject", Subject);
            command.Parameters.AddWithValue("@Details", Details);
       


            command.Connection.Open();
            command.ExecuteNonQuery();
            command.Connection.Close();

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            WriteReview.SaveCustomerreview(NameTextBox.Text, SubjectTextBox.Text, DetailsTextBox.Text);
        }

   }
}
 
error-->

Server Error in '/' Application.


Incorrect syntax near 'Reviews'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'Reviews'.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Incorrect syntax near 'Reviews'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2072782
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5061884
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   jonkohn_OnFocus.WriteReview.SaveCustomerreview(String Name, String Subject, String Details) in WriteReview.aspx.cs:37
   jonkohn_OnFocus.WriteReview.Button1_Click(Object sender, EventArgs e) in WriteReview.aspx.cs:44
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
 

 

 

301 Redirect


All Forums 22 May 2012, 2:53 am CEST

HI ,

I need to put 301 redirect in my web site. [Inner pages not the root domain]

Example: if someone hits http://wwww.testsite/AspNet/SDetails?id=3444

Redirect this to http://wwww.testsite/AspNet/SDetails?id=4000

Thank you.

Gridview Edit control and it's textBox


All Forums 22 May 2012, 2:53 am CEST

Hi,

I built a Gridview and then added the Command Field to it, which has Edit, Delete, Select, and update functionalities.

When clicking on Edit link, textboxes open on the selected row to enable updating the row.  Users enter the text in the textbox and then click update to save it in the database.

I would like to add the ability for the users to add text and heyperlinks that will display as a hyperlink after its saved.  The way as it is now, the Gridview will only display it as a text after its saved.

Hope it is possible to do it ????

Thank you,

Rad1

Default Role provider could not be found?


All Forums 22 May 2012, 2:53 am CEST

Hi all,

I am trying to run a basic auction website via VS2010 that I have downloaded from http://auctionsk.codeplex.com/

But cannot get it to run, recieving the error:

Default Role provider could not be found

Line 25: </providers>

Line 26: </siteMap>

Line 27: <roleManager enabled="true"/>

Line 28: <compilation debug="true" targetFramework="4.0">

Line 29: <assemblies>

If I try to add a user via the Website/ASP.NET Configuration i get this:

An error was encountered. Please return to the previous page and try again. The following message may help in diagnosing the problem: Default Role Provider could not be found. (C:UsersROBDesktopASKweb.config line 49) at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_users_adduser_aspx.PopulateCheckboxes() in c:WindowsMicrosoft.NETFrameworkv4.0.30319ASP.NETWebAdminFilesSecurityUsersaddUser.aspx:line 28 at ASP.security_users_adduser_aspx.Page_Load() in c:WindowsMicrosoft.NETFrameworkv4.0.30319ASP.NETWebAdminFilesSecurityUsersaddUser.aspx:line 22 at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I have tried all sorts for the past few hours to resolve this, but to no luck!

Has anyone got any ideas?

Thanks

P.S. I am also unable to access the code behind! If I add a button and double click it I get "Could not complete the action"!  Is there a reason for this? Yell

Basic URL ReWriting


All Forums 22 May 2012, 1:48 am CEST

Hi All,

I have an application in which there will be urls like http://mywebsite.com/college.aspx?id=12 now i want this url to be http://mywebsite.com/college/12 what is the easiest way to do it.

Note: I am using request.QueryString to read the college ID and display the data. Will this work after the URL rewrite? If not how should I get the querystring value?

Any help will be greatly appreciated!!!

Thanks in advance, Ram

  

HttpModule for error handling fails in IIS7


All Forums 22 May 2012, 1:48 am CEST

This is posted here because it might be module related. MVC 3+, Win7 (development)  (IIS7 production)

Using VS2010 Local server my HttpModule for exception handling works fine.  When going to IIS I get the yellow screen of death.

The example below is for MVC, but an extremely similar Module which worked for years for Asp.net applications is now failing the same way.  It differed by instead of returning a view, returned an embedded aspx page.

So I tried messing with the web.config by using httpErrors and I tried messing with the response by adding: TrySkipIisCustomErrors

But nothing is working.

I have an HttpModule with

ExceptionHandlerHelper : IHttpModule
    application.Error += new EventHandler(LogUheToUI); //regular UHE


Web.Config
    <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" >     
    </httpErrors>
 <system.webServer>     
<
httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" > <modules runAllManagedModulesForAllRequests="true"> <add name="ExceptionHandlerHelper" type="MvcUtil.ExceptionHandler.ExceptionHandlerHelper"/> </modules>
<system.web>
    <httpModules>
      <add name="ExceptionHandlerHelper" type="MvcUtil.ExceptionHandler.ExceptionHandlerHelper"/>
    </httpModules>


 private static void LogUheToUI()
        {
            HttpContext ctx = HttpContext.Current;
            HttpRequestWrapper req = new HttpRequestWrapper(ctx.Request);
            Exception ex = ctx.Server.GetLastError();
            ctx.Response.Clear();
            
 
            if (ctx.CurrentHandler != null)  // i.e. we are in the MVC handler
            {
                RequestContext rc = ((MvcHandler)ctx.CurrentHandler).RequestContext;
 
                ctrler c = new ctrler();
                ControllerContext cc = new ControllerContext(rc, c);
 
                ViewResult viewResult = new ViewResult { ViewName = "Error" };  //This needs to be a view in the real app which will load the partial view from the dll.
                viewResult.ViewBag.Title = FormatDisplayString("(ApplicationName) problem");
                viewResult.ExecuteResult(cc);
 
                // If ajax request we need to tell it that failure occured.  
                // So we put in a 400 Status Code.  Otherwise it would get this error page back as a success result.
                // This error page will be returned in the Error response. 
                if (req.IsAjaxRequest())
                    rc.HttpContext.Response.StatusCode = 400;
 
               ctx.Response.TrySkipIisCustomErrors = true;
                ctx.Server.ClearError();
            }
            else if (ex is HttpRequestValidationException)  //this occurs before MVC handler
            {
                ctx.Response.Clear();
                
                string resMsg = "<html><body><span style="font-size: 12pt; color: red">"
                    + "Your input contains text that is not allowed.<br />"
                    + "Text provided cannot contain character combinations such as :"
                    + "<ul><li>&lt;janedoe@lanl.gov&gt;</li><li>&amp;#949;</li><li>&lt;Text</li></ul>"
                    + "The application treats this as an attempt to enter a potentially malicious programming string that could be executed when a person browses a webpage. Please review your input and remove any entries that resemble the above."
                    + "<br/>";
 
                if (req.IsAjaxRequest()) //if ajax request we have to set the status code to an error code so that ajax does not view this response as success.  On error a modal dialog will be shown with this response.
                    ctx.Response.StatusCode = 400;
                else //if not ajax provide a javascript back button
                    resMsg = resMsg + "<br/><br/><input id="btnBack" type="button" value="Back" onclick="history.back()"/>";
 
                resMsg = resMsg + "<br/></span></body></html>";
                    
                ctx.Response.Write(resMsg);
                ctx.Response.TrySkipIisCustomErrors = true;
                ctx.Response.Flush();
                ctx.Server.ClearError();
                ctx.Response.End();
            }
 
        }

SQL auth after int security


All Forums 22 May 2012, 1:48 am CEST

when I first create our Windows forms application I used integ security to allow auto generated tables to be done. I then go and male user and use the SQl authentication for the connection string from then on. Is this good practice?

Deserialize Dynamic JSON


All Forums 22 May 2012, 1:48 am CEST

Hey All,

I have some JSON that is dynamic, in that I don't know exactly what will be included, but need a way deserialize and parse the data. I have been using JSON.net up until now, but am really at a loss on how to do this as most examples I find have static JSON. I'm open to any method or technology that would make it easier.

I need to parse the JSON from C# and not Javascript.

Any thoughts or pointers to examples?

Thanks Jay 

Vs11 con string change


All Forums 22 May 2012, 1:48 am CEST

How is it when you use v studio 11 to create forms authentication tables .when you change the connection string details vs11 will automatically change the schema. When I do the same thing in vs2010 I get error cant find aspnet_checksxhemaverion

Dropdown error


All Forums 22 May 2012, 1:48 am CEST

linqDataContext dtcontext;

mylin =new linqDataContext();

var listsucursales = from m in

mylin.sucursales orderby

m.nombre_sucursal

selectm;

grlist.DataSource = listsucursales;

grlist.DataBind();

and fill ok..when i try to catch the selected value it only give me the first value,

but wiith linqdatasource component it work all right..what happened?

Need help with simple example of populating Chart control using Linq2sql


All Forums 22 May 2012, 1:48 am CEST

Shown Below are stored procedure and code. As a test example I want to plot utilization vs Month in a
chart control. How to I complete the code to bind the chart to data from my stored procedure using Linq2SQL.
 
 
PROCEDURE dbo.procGetUtilityData

AS
         SET NOCOUNT ON 
         SELECT       Month, CAST([Useage 2012] AS float) / CAST([Useage 2011] AS float) AS [Utilization ]
         FROM            Utility


------------------------------------------------------------
Code

    Protected Sub BindChart()
        Dim db As New DataClassesDataContext
        Dim src = From s In db.procGetUtilityData
                  Select s


        Chart1.DataSource = src
        Chart1.DataBind()
    End Sub

clickable div elements


All Forums 22 May 2012, 1:48 am CEST

hey, im working on a project and decided to start with the html layout first

i was wondering how can i make a clickable elements such as divs or even li insted of

using the <input> tags for example the menu here (asp.net) at the forums when a mouse hover is trigerd a sub menu

appears, 

another question -  take facebook header, when you click the tiny message icon a sub menu shows up

is that a javascript / jquery ? im not talking about the data that's obviously ajax, im talking about the html itself  

  

DisplayFor templates seem to quit working if the same model is reused within the template


All Forums 22 May 2012, 1:48 am CEST

I have a really strange situation.  I have a single Model, and two templates that are both strong-typed on the type of this model.  The templates are nested, or in other words, I use DisplayFor on the second Template from within the first template.  If I use the model associated with the first template, in the DisplayFor call for the second template, the second template does not render.  If I use another instance of the same model type, everything works fine.  It seems like there is some sort of cycle checking on the models associated with nested templates.  

Model:

public class MyModel
    {
        public string Value { get; set; }
        public MyModel Copy
        {
            get { return (MyModel) this.MemberwiseClone(); }
        }

        public MyModel MySelf
        {
            get { return this; }
        }
    }

DisplayTemplate 1:

@model TestNestedTemplateSameReference.Models.MyModel

<div>Model1</div>
<div>@Model.Value</div>
<div>@Html.DisplayFor(x=>x, "ModelTemplate2")</div>

DisplayTemplate 2:

@model TestNestedTemplateSameReference.Models.MyModel

<div>Model2</div> <div>@Model.Value</div>

Interestingly if instead of calling 

@Html.DisplayFor(x=>x, "ModelTemplate2")

I call it with the Copy property

<div>@Html.DisplayFor(x=>x.Copy, "ModelTemplate2")</div>

everything works fine as the actual instance of the MyModel class is different.

Does anyone know why this is done.  Is there a viable workaround.  It seems like this is a perfectly legitimate usage which shouldnot cause a stack overflow, or any similar issues.  I could see how this could be used to protect against cycles for DisplayFor call without template name, but if I specify the template name seems like it should work fine.  

It seems like it would be dangerous to bind the same model to multiple EditFor templates, but DisplayFor seems safe.

I can of course create a separate model for nesting level, but that is creating redundand class.

Any help is appreciated.

HttpModule for errors not working in iis7


All Forums 22 May 2012, 1:48 am CEST

This is posted here because it might be web.config related. MVC 3+, Win7 (development)  (IIS7 production)

Using VS2010 Local server my HttpModule for exception handling works fine.  When going to IIS I get the yellow screen of death.

The example below is for MVC, but an extremely similar Module which worked for years for Asp.net applications is now failing the same way.  It differed by instead of returning a view, returned an embedded aspx page.

So I tried messing with the web.config by using httpErrors and I tried messing with the response by adding: TrySkipIisCustomErrors

But nothing is working.

I have an HttpModule with

ExceptionHandlerHelper : IHttpModule
    application.Error += new EventHandler(LogUheToUI); //regular UHE


Web.Config
    <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" >     
    </httpErrors>
 <system.webServer>     
<
httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" > <modules runAllManagedModulesForAllRequests="true"> <add name="ExceptionHandlerHelper" type="MvcUtil.ExceptionHandler.ExceptionHandlerHelper"/> </modules>
<system.web>
    <httpModules>
      <add name="ExceptionHandlerHelper" type="MvcUtil.ExceptionHandler.ExceptionHandlerHelper"/>
    </httpModules>


 private static void LogUheToUI()
        {
            HttpContext ctx = HttpContext.Current;
            HttpRequestWrapper req = new HttpRequestWrapper(ctx.Request);
            Exception ex = ctx.Server.GetLastError();
            ctx.Response.Clear();
            
 
            if (ctx.CurrentHandler != null)  // i.e. we are in the MVC handler
            {
                RequestContext rc = ((MvcHandler)ctx.CurrentHandler).RequestContext;
 
                ctrler c = new ctrler();
                ControllerContext cc = new ControllerContext(rc, c);
 
                ViewResult viewResult = new ViewResult { ViewName = "Error" };  //This needs to be a view in the real app which will load the partial view from the dll.
                viewResult.ViewBag.Title = FormatDisplayString("(ApplicationName) problem");
                viewResult.ExecuteResult(cc);
 
                // If ajax request we need to tell it that failure occured.  
                // So we put in a 400 Status Code.  Otherwise it would get this error page back as a success result.
                // This error page will be returned in the Error response. 
                if (req.IsAjaxRequest())
                    rc.HttpContext.Response.StatusCode = 400;
 
               ctx.Response.TrySkipIisCustomErrors = true;
                ctx.Server.ClearError();
            }
            else if (ex is HttpRequestValidationException)  //this occurs before MVC handler
            {
                ctx.Response.Clear();
                
                string resMsg = "<html><body><span style="font-size: 12pt; color: red">"
                    + "Your input contains text that is not allowed.<br />"
                    + "Text provided cannot contain character combinations such as :"
                    + "<ul><li>&lt;janedoe@lanl.gov&gt;</li><li>&amp;#949;</li><li>&lt;Text</li></ul>"
                    + "The application treats this as an attempt to enter a potentially malicious programming string that could be executed when a person browses a webpage. Please review your input and remove any entries that resemble the above."
                    + "<br/>";
 
                if (req.IsAjaxRequest()) //if ajax request we have to set the status code to an error code so that ajax does not view this response as success.  On error a modal dialog will be shown with this response.
                    ctx.Response.StatusCode = 400;
                else //if not ajax provide a javascript back button
                    resMsg = resMsg + "<br/><br/><input id="btnBack" type="button" value="Back" onclick="history.back()"/>";
 
                resMsg = resMsg + "<br/></span></body></html>";
                    
                ctx.Response.Write(resMsg);
                ctx.Response.TrySkipIisCustomErrors = true;
                ctx.Response.Flush();
                ctx.Server.ClearError();
                ctx.Response.End();
            }
 
        }

Question on the rating control


All Forums 22 May 2012, 12:42 am CEST

I want the control to initially display a rating based on the average rating given so far.  Say customers are fairly happy with an item and have given it an average of 4 out of 5 stars.  The current user really likes the item, and rates it 5 stars.  So far so good, the 5 start rating is recognized and added to the database.

But what if the current user also thought the item deserved 4 out of 5 stars?  Because the control uses a OnChanged event, the current user is not able to rate the product.  The average rating is 4, and the user rates the item a 4, there is no change to trigger the OnChange event.

I would think this is a common use for the control, how is this handled?

Creating Custom Controls


All Forums 22 May 2012, 12:42 am CEST

I am looking to create this custom user control.  Know to create the custom control, but what I am having a hard time with is publishing it into a DLL so that I have distribute my other applications.

Can someone point me in the right direction?

Thanks in advance,

Send an Email


All Forums 22 May 2012, 12:42 am CEST

I am trying to send an email...it works fine on the development server but not on the production server.  I get the error "The SMTP host was not specified. " on the production server.  When I add the settings to the web.config file it doesn't work on the development or the production.  I get the error "Client doesn't have permissions..."  Any ideas?   Thx. 

I have the following in my web.config file:

  <system.net>

    <mailSettings>

      <smtp from="">

        <network defaultCredentials="false" host="" password="" userName="" />

      </smtp>

    </mailSettings>

  </system.net>

MaskedEdit / Calendar IE9 Issue


All Forums 22 May 2012, 12:42 am CEST

I'm trying to use the MaskedEditExtender and CalendarExtendar from the Toolkit.

I am having an issue when you type a date in the TextBox after the first time, it is not focusing to that date when you open the Calendar. It does not work in IE9. It does work in IE9+compatability mode. I can reproduce this on the Toolkit Demo site as well.

Steps to reproduce:

  1. In IE9 (non-compatibility mode)
  2. Go to http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/MaskedEdit/MaskedEdit.aspx
  3. In the 3rd field, type 12/12/2012
  4. Click the Calendar icon
  5. 12/12/2012 is selected in the Calendar
  6. Now change your date text to 12/12/2010
  7. Click the Calendar icon
  8. 12/12/2012 is still selected in the Calendar
  9. Repeat the steps in compatibility mode
  10. In step 8, 12/12/2010 will be selected as expected

Anyone else have this issue? If so, has anyone found a work-around?

How to retrieve data from a xml


All Forums 22 May 2012, 12:42 am CEST

Guys, i'm developing a little application that receives a xml with some data that a want to retrive. The xml is the following:

<ArrayOfGame xmlns="http://schemas.datacontract.org/2004/07/TesteWebService.Model" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Game>
    <ID>1</ID>
    <genre>rpg</genre>
    <name>Diablo</name>
  </Game>
  <Game>
    <ID>2</ID>
    <genre>rts</genre>
    <name>Starcraft</name>
  </Game>
  <Game>
    <ID>3</ID>
    <genre>mmorpg</genre>
    <name>World of Warcraft</name>
  </Game>
  <Game>
    <ID>4</ID>
    <genre>Simulador Corrida</genre>
    <name>F1 2011</name>
  </Game>
  <Game>
    <ID>5</ID>
    <genre>Futebol</genre>
    <name>Pes2011</name>
  </Game>
  <Game>
    <ID>6</ID>
    <genre>fps</genre>
    <name>Modern Warfare</name>
  </Game>
</ArrayOfGame>

I'm receive it from a web service with the code that follows:

private void fillTextBox()
        {
            XNamespace te = "http://schemas.datacontract.org/2004/07/TesteWebService.Model";
            using (HttpClient client = new HttpClient("http://localhost:8080/teste/"))
            {
                using (HttpResponseMessage response = client.Get("games"))
                {
                    response.EnsureStatusIsSuccessful();
                    
                    XElement elementos = response.Content.ReadAsXElement();
                    lista.Text = "";


                    StringBuilder t= new StringBuilder();
                    var names = elementos.Descendants(te +"name").Select(element => element.Value);
                    foreach (string s in names)
                    {
                        t.AppendLine(s);
                    }
                    lista.Text= t.ToString();

                }
            }

That code just get the names, but a want to get the id, name and genre. Thank you for any help

More