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 9047431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:54:28+00:00 2026-06-16T11:54:28+00:00

Getting an Access Violation runtime error when trying to get a WebBrowser’s .Url property

  • 0

Getting an “Access Violation” runtime error when trying to get a WebBrowser’s .Url property in an Outlook Add-In I’m writing. Need some help on how to get past this please. Research indicates I may need to set “FullTrust” permissionset, have tried that with no success.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Security;
using System.Security.Permissions;

namespace MyAddin1
{

public partial class authForm : Form
{

    public string currentUrl;

    public authForm()
    {
        InitializeComponent();
    }


    private void formLoaded(object sender, EventArgs e)
    {
        WebBrowser browser = new WebBrowser();
        browser.Location = new System.Drawing.Point(0, 0);
        browser.Width = 870;
        browser.Height = 510;
        browser.Navigate("https://www.yammer.com/dialog/oauth?client_id=<redacted>&response_type=token");
        browser.Show();

        //runtime error occurs on following line
        currentUrl = browser.Url.ToString();


        browser.Url = new Uri("http://www.yahoo.com");

        browser.Navigated += new WebBrowserNavigatedEventHandler(checkForToken);


        this.Controls.Add(browser);
    }

    private void checkForToken(object sender, EventArgs e)
    {
        MessageBox.Show(currentUrl);
    }




}

}

  • 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-16T11:54:31+00:00Added an answer on June 16, 2026 at 11:54 am

    browser.Url is initially null, Change your code as below.

    if (browser.Url != null)
    {
        currentUrl = browser.Url.ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting access violation while writing error in the below code while putting null
I am getting an access violation error in an unmanaged dll I am writing,
I am getting an unexpected Access Violation error in the following code: program Project65;
Getting a strange error when trying to insert data into an Access database using
Hi I am getting an access violation error..... What might be the problem in
I am getting access violation error when I run the following code on Visual
I'm getting this error : Warning: PDO::query() [pdo.query]: SQLSTATE[42000]: Syntax error or access violation:
I'm kind of new to Visual Studio, and I'm getting Access Violation error in
I am getting access violation error in the below code..i have pointed it out
I am getting Access violation error from the debugger, but I really have no

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.