locked
ERROR: System.Xml.XmlException: 'Name cannot begin with the '<' character, hexadecimal value 0x3C RRS feed

  • Question

  • Whenever I try to send a POST request to my API it gives me this error in my WPF application. I've tried to search for "<<<" in my application but there were no results for this. I've been trying to fix this issues for several days, but with no luck.

    This is my back-end of my WPF page:
    {
                // create new restclient class, with the base url filled in the ()
                var client = new RestClient("http://thewebsite.com");
    
                //  create new restrequest class, withe the rest of the url we want filled in
                var request = new RestRequest("/api/v2/projects");
    
                string title = Title.Text;
                string description = Description.Text;
                string deadline = Deadline.Text;
    
                // add the content here: user is automatically created related to the api token, they will be the owner. 
                request.AddBody(new { title = title, description = description, deadline = deadline});
    
                request.Method = Method.POST;
    
        
                request.AddHeader("Accept", "application/json");
    
             
                client.AddDefaultHeader("Authorization", string.Format("Bearer {0}", Global.ApiToken));
    
                // we execute and get the content
                var response = client.Execute(request);
    
    
                if (response.StatusCode.ToString() == "OK" || response.StatusCode.ToString() == "200")
                {
                    MessageBox.Show("OK");
    
                }
                else if (response.StatusCode.ToString() == "422")
                {
                    MessageBox.Show("NOT OK");
    
                }
                else if (response.StatusCode.ToString() == "401")
                {
                    MessageBox.Show("Unauth");
    
                }
                else
                {
                    MessageBox.Show("??");
                }

    The front end (XAML):
    <UserControl x:Class="Prototype.Projects.ProjectCreate"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:local="clr-namespace:Prototype.Projects"
                 mc:Ignorable="d"
                 d:DesignHeight="570" d:DesignWidth="830">
    
        <!-- whole projects grid -->
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="51*" />
                <RowDefinition Height="55*" />
                <RowDefinition Height="Auto" MinHeight="464"/>
            </Grid.RowDefinitions>
    
            <Grid.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA0A0A0" Offset="1" />
                    <GradientStop Color="#FFDADADA" />
                </LinearGradientBrush>
            </Grid.Background>
    
            <!-- Tab Description -->
            <Grid Row="0">
                <TextBlock Margin="10" FontFamily="Century Gothic" FontSize="25" Text="Nieuw Project" />
            </Grid>
            <Grid Row="1">
    
                <TextBlock Margin="10" FontSize="20" FontFamily="century gothic" TextWrapping="Wrap"
                               Text="Voer hieronder de informatie van het project in" Grid.ColumnSpan="3" />
    
            </Grid>
    
            <!-- Backlog Items -->
            <Grid Row="2">
                <StackPanel>
                    <Grid>
                        <Label FontFamily="century gothic" Margin="55,10,4,10">Titel</Label>
                        <TextBox FontFamily="century gothic" Background="White" HorizontalAlignment="right"
                                 Margin="0,10,110,10" Width="600" Name="Title" />
                    </Grid>
                    <Grid>
                        <Label FontFamily="century gothic" Margin="10,10,38,10">Beschrijving</Label>
                        <TextBox FontFamily="century gothic" Background="White" HorizontalAlignment="right"
                                 Margin="0,10,110,10" Width="600" Height="100" TextWrapping="Wrap" Name="Description"/>
                    </Grid>
                    <Grid>
                        <Label FontFamily="century gothic" Margin="25,10,20,10">Deadline (2020-01-15 00:00:00)</Label>
                        <TextBox FontFamily="century gothic" Background="White" HorizontalAlignment="right"
                                 Margin="0,10,562,10" Width="148" Name="Deadline"/>
                        <!-- -->
                        <Button x:Name="Create_Project_Button" FontFamily="century gothic" VerticalAlignment="Bottom" HorizontalAlignment="Right"
                                Width="250" Margin="0,0,110,13" Click="Create_Project_Button_Click">
                            <TextBlock FontFamily="century gothic">Project aanmaken</TextBlock>
                        </Button>
                    </Grid>
                    <!-- -->
                    <!-- -->
                </StackPanel>
                <!-- -->
                <!-- -->
            </Grid>
        </Grid>
    </UserControl>

    Monday, March 16, 2020 1:12 PM

All replies