M
Martin
Hi
I am attempting to write a small application that will allow users to
manage the AddressBar entries within Internet Explorer. The typed URLs
in the AddressBar can be found at
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs and I
have successfully managed to get this list via a Windows C# .NET app
with the following code :
public Form1()
{
InitializeComponent();
try
{
RegistryKey key = Registry.CurrentUser;
RegistryKey urlKey =
key.OpenSubKey(@"Software\Microsoft\InternetExplorer\TypedURLs");
keyNames = urlKey.GetValueNames();
foreach(string s in keyNames)
{
lbTypedUrls.Items.Add(urlKey.GetValue(s));
}
}
catch(Exception e)
{
MessageBox.Show(this, "Error Occurred : " + e.Message);
}
}
This works fine and my listbox is correctly populated with the
AdressBar URLs.
However, if I try the same technique in a Web App using the following
code :
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
try
{
RegistryKey key = Registry.CurrentUser;
RegistryKey urlKey =
key.OpenSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs");
keyNames = urlKey.GetValueNames();
foreach(string s in keyNames)
{
lbTypedUrls.Items.Add(urlKey.GetValue(s).ToString());
}
}
catch(Exception exp)
{
Response.Write("An Error Occurred : " + exp.Message);
}
}
}
I am getting an error stating that, "An Error Occurred : Object
reference not set to an instance of an object."
The line : RegistryKey urlKey =
key.OpenSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs"); Is
failing to load the RegistryKey object.
Can anyone see anything obvious that I am missing or have done wrong?
I don't think this is a permissions error. I have Web.config set up to
impersonate a specific username/password that definately has access to
the reg key.
I have read various other threads were people are receiving Permission
errors but I am not even getting that far
The app that I am writing will not be 'Served' over the internet but
will be installed as an App to run on a local machine. I just want to
use IE as the User Interface.
Any help would be greatly appreciated.
Many thanks,
Martin
I am attempting to write a small application that will allow users to
manage the AddressBar entries within Internet Explorer. The typed URLs
in the AddressBar can be found at
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs and I
have successfully managed to get this list via a Windows C# .NET app
with the following code :
public Form1()
{
InitializeComponent();
try
{
RegistryKey key = Registry.CurrentUser;
RegistryKey urlKey =
key.OpenSubKey(@"Software\Microsoft\InternetExplorer\TypedURLs");
keyNames = urlKey.GetValueNames();
foreach(string s in keyNames)
{
lbTypedUrls.Items.Add(urlKey.GetValue(s));
}
}
catch(Exception e)
{
MessageBox.Show(this, "Error Occurred : " + e.Message);
}
}
This works fine and my listbox is correctly populated with the
AdressBar URLs.
However, if I try the same technique in a Web App using the following
code :
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
try
{
RegistryKey key = Registry.CurrentUser;
RegistryKey urlKey =
key.OpenSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs");
keyNames = urlKey.GetValueNames();
foreach(string s in keyNames)
{
lbTypedUrls.Items.Add(urlKey.GetValue(s).ToString());
}
}
catch(Exception exp)
{
Response.Write("An Error Occurred : " + exp.Message);
}
}
}
I am getting an error stating that, "An Error Occurred : Object
reference not set to an instance of an object."
The line : RegistryKey urlKey =
key.OpenSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs"); Is
failing to load the RegistryKey object.
Can anyone see anything obvious that I am missing or have done wrong?
I don't think this is a permissions error. I have Web.config set up to
impersonate a specific username/password that definately has access to
the reg key.
I have read various other threads were people are receiving Permission
errors but I am not even getting that far

The app that I am writing will not be 'Served' over the internet but
will be installed as an App to run on a local machine. I just want to
use IE as the User Interface.
Any help would be greatly appreciated.
Many thanks,
Martin