Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:47:45+00:00 2026-06-12T07:47:45+00:00

Currently, I’m seeing a strange behavior in my .NET 2.0 WinForms application. Hosting a

  • 0

Currently, I’m seeing a strange behavior in my .NET 2.0 WinForms application.

Hosting a WebBrowser control that pulls data from its own app-built-in web server (this one), everything works fine, until it comes to Google Web Fonts.

Steps:

Under Windows 7, the following behavior occurs:

1.) Start the application. The page does not display the Google Web Fonts:

enter image description here

2.) Open the URL of the built-in web server inside a stand-alone instance of Internet Explorer:

enter image description here

3.) Go back to the C# application, hit F5:

enter image description here

Now, the font is visible inside my application, too.

Behavior:

It seems that the stand-alone IE does additional things, that the hosted IE inside my application is not allowed to do.

Once the URL was opened inside the stand-alone IE, I can close both, my application and IE and restart my application and still get the correct behavior.

When clearing IE data (cache, cookies, etc.) the steps 1-3 are required again to get the Google Web Font into the hosted web browser.

My assumption:

I am guessing that this has something to do with permissions that IE seems to require to “install” the web font in its locale cache. I’ve just added a Access-Control-Allow-Origin:* to my request header, but this does not seem to improve anything.

My question:

Do you have any hints on how to make Google Web Fonts working in my scenario, without the need to fire up the stand-alone IE?

Update 2013-08-22 – SOLUTION:

Based on Adam’s suggestion, I changed the user agent of the WebBrowser control and this worked. Now I do have web fonts inside my WinForms application with a hosted browser.

The code looks something like:

public void ChangeUserAgent()
{
    // https://stackoverflow.com/a/12648705/107625
    const string ua = @"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)";

    // https://stackoverflow.com/q/937573/107625
    UrlMkSetSessionOption(UrlmonOptionUseragent, ua, ua.Length, 0);
}

With those P/Invoke helper functions:

[DllImport(@"urlmon.dll", CharSet = CharSet.Ansi)]
private static extern int UrlMkSetSessionOption(
    int dwOption, 
    string pBuffer, 
    int dwBufferLength, 
    int dwReserved);

private const int UrlmonOptionUseragent = 0x10000001;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:47:48+00:00Added an answer on June 12, 2026 at 7:47 am

    Have you tried downloading the fonts and running them from your web server, instead of from Google’s? You should be able to download the CSS file and WOFF/EOT file’s from Google’s web servers and place them locally on your web server. You will need to change Google’s CSS file to point to your local WOFF files, after that.

    I know this doesn’t really fix the strange behavior of the WebBrowser control, but it may serve as a work-around.

    Edit: It seems like the CSS is generated dynamically per browser. I get different CSS for Chrome than I do IE. This might still work for you though, since it seems it’s running in a controlled environment through the WebBrowser control so it should always be IE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I am writing a MiddleWare application that synchronizes information between and accounting application
Currently I have a UITableview, I have enough data that cannot be shown entirely
Currently working with converting SQLException error messages into messages that are more useful for
Currently i have a node.js and socket.io application in development on my local machine
Currently I have a date in my clients data table and it is stored
Currently, my MVC 3 app has a dependency on a static class that is
Currently I am using Amazon Cloudfront to service static objects on my ASP.Net MVC3
Currently, Enum.Parse supports only the comma as the value separator, so that MemberOne,MemberThree will
Currently I'm using the Jackson JSON Processor to write preference data and whatnot to
Currently playing about with KnockoutJS. Just trying to update an observable array from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.