Click here to Skip to main content
15,915,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I'm creating an adrotator in asp.net for a website. I'm getting the following error

Server Error in '/' Application.

HTTP Error 400 - Bad Request.

Version Information: ASP.NET Development Server 10.0.0.0

-I'm posting the codes here

Ad.xml

XML
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
      <Ad>
          <ImageUrl>ad1/ad1.jpg</ImageUrl>
          <NavigateUrl>
            http://www.microsoft.com
          </NavigateUrl>
          <AlternateText>

    </AlternateText>
        <Impressions>20</Impressions>
         <Keyword>Asp.Net</Keyword>

  </Ad>
     <Ad>
          <ImageUrl>ad1/ad2.jpg</ImageUrl>
         <NavigateUrl>
           http://www.microsoft.com

         </NavigateUrl>
         <AlternateText>


    </AlternateText>
       <Impressions>30</Impressions>
        <Keyword>Asp.Net</Keyword>

  </Ad>
  <Ad>
    <ImageUrl>ad1/ad3.jpg</ImageUrl>
    <NavigateUrl>
      http://www.microsoft.com
    </NavigateUrl>
    <AlternateText>


    </AlternateText>
    <Impressions>30</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>
  <Ad>
    <ImageUrl>ad1/ad4.jpg</ImageUrl>
    <NavigateUrl>
      http://www.microsoft.com
    </NavigateUrl>
    <AlternateText>


    </AlternateText>
    <Impressions>30</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>
  <Ad>
    <ImageUrl>ad1/ad5.jpg</ImageUrl>
    <NavigateUrl>
      http://www.microsoft.com

    </NavigateUrl>
    <AlternateText>


    </AlternateText>
    <Impressions>30</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>
  <Ad>
    <ImageUrl>ad1/ad6.jpg</ImageUrl>
    <NavigateUrl>
      http://www.microsoft.com
    </NavigateUrl>
    <AlternateText>


    </AlternateText>
    <Impressions>30</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>
  <Ad>
    <ImageUrl>ad1/ad7.jpg</ImageUrl>
    <NavigateUrl>
     http://www.microsoft.com

    </NavigateUrl>
    <AlternateText>

    </AlternateText>
    <Impressions>30</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>

</Advertisements>


Master1.master

<asp:AdRotator ID="AdRotator1" runat="server" Height="300px"
AdvertisementFile="~/ad.xml" Width="280px" />

I'm not getting redirected to google page.


Please Help
Posted
Comments
Sreekanth Mothukuru 8-Oct-15 8:24am    
When all your links are to Microsoft why it would redirect to google page ?
ZurdoDev 8-Oct-15 8:54am    
Need more of a stack trace to see what is happening.
Vinod P 8-Oct-15 8:57am    
What stack trace i didnt understand
ZurdoDev 8-Oct-15 9:02am    
The full error.
Vinod P 8-Oct-15 9:17am    
I'd already posted the error at the top. I didnt get any other error

1 solution

As worked out in the comments, remove the whitespace around the urls and try to match the format shown in https://support.microsoft.com/en-us/kb/305035#bookmark-5[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900