webbrowser.navigate

A

adnan.masood

I have a webbrowser control in winform application. This is being
called from a timer event every 3 minutes. The event has this code
this.wbPage.Navigate("mywebpage.aspx?query=" + txtSearch.text);

Here is the code in my mywebpage.aspx's page load event

string eBay = @"
<html>
<body style=""margin-top:2"">
<center>
<script src='http://adn.ebay.com/files/js/min/
ebay_activeContent-min.js'></script>
<script src='http://adn.ebay.com/cb?
programId=1&campId=5335809704&toolId=10026&keyword={0}&sortBy=2&
showItems=1&width=728&height=57&font=1&textColor=333366&linkColor=333333&arrowColor=8BBC01&
color1=B5B5B5&color2=FFFFFF'></script>
</center>
</body>
</html>
";

string query = Page.Request["query"];
if ((query == null) || (query.Trim() == string.Empty))
query = "cars";

text = String.Format(eBay2, query);

Page.Response.Clear();
Page.Response.ClearHeaders();
Page.Response.ClearContent();
Page.Response.ContentType = "text/html";
Page.Response.Output.WriteLine(text);
Page.Response.Flush();
Page.Response.End();

The idea of this aspx page is that show ads from ebay based on the
search term from user. It works fine the first time the event is
fired. Shows the right ad depending on the text. But after that when
event is fired the whole page just goes blank and no ad is being
shown. If I look at the source then it looks fine, but wbPage shows
nothing. Interesting thing is that if I run the same code in IE
browser then it shows the ad properly and everytime I refresh the page
then it shows different ad based on the query.

What am I missing with webbrowser.navigate event. I even tried to
change the URL by putting random tag in the query but still the same
behaviour.

Works fine in browser, but doesn't work in this control...what am I
doing wrong?

thanks
 
I

Ignacio Machin ( .NET/ C# MVP )

I have a webbrowser control in winform application.  This is being
called from a timer event every 3 minutes.  The event has this code
 this.wbPage.Navigate("mywebpage.aspx?query=" + txtSearch.text);

Here is the code in my mywebpage.aspx's page load event

    string eBay = @"
    <html>
      <body style=""margin-top:2"">
        <center>
        <script src='http://adn.ebay.com/files/js/min/
ebay_activeContent-min.js'></script>
<script src='http://adn.ebay.com/cb?
programId=1&campId=5335809704&toolId=10026&keyword={0}&sortBy=2&
showItems=1&width=728&height=57&font=1&textColor=333366&linkColor=333333&arrowColor=8BBC01&
color1=B5B5B5&color2=FFFFFF'></script>
       </center>
      </body>
    </html>
    ";

        string query = Page.Request["query"];
        if ((query == null) || (query.Trim() == string.Empty))
            query = "cars";

        text = String.Format(eBay2, query);

        Page.Response.Clear();
        Page.Response.ClearHeaders();
        Page.Response.ClearContent();
        Page.Response.ContentType = "text/html";
        Page.Response.Output.WriteLine(text);
        Page.Response.Flush();
        Page.Response.End();

The idea of this aspx page is that show ads from ebay based on the
search term from user.  It works fine the first time the event is
fired.  Shows the right ad depending on the text.  But after that when
event is fired the whole page just goes blank and no ad is being
shown.  If I look at the source then it looks fine, but wbPage shows
nothing.  Interesting thing is that if I run the same code in IE
browser then it shows the ad properly and everytime I refresh the page
then it shows different ad based on the query.

What am I missing with webbrowser.navigate event.  I even tried to
change the URL by putting random tag in the query but still the same
behaviour.

Works fine in browser, but doesn't work in this control...what am I
doing wrong?

thanks

Hi,

Maybe it's not your problem, but ebay refusing to serve you the page
you were expecting, try to set the client ID to the one in IE, also
you could use a webrequest to see what are you being served.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top