Help! - Registry & ASP.Net

franciskwang

New member
Joined
Dec 20, 2006
Messages
1
Programming Experience
1-3
I am trying to pull some registry values off to a webpage and I hit a snag...

I am using GetStringValue method from the StdRegProv class. It supposed to return a non-zero value if it fails (according to MSDN) but when the subkey is non-existent, I get the following error.

Please, someone tell me why and how I can work around this. I tried Try/Catch but it gives me a "Page Not Found" error!

Thanks in advanced

Server Error in '/Siras' Application.
--------------------------------------------------------------------------------
The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
Source Error:

Line 36:
Line 37: For Each keyItem In arKeys
Line 38: irc = obj.GetStringValue(HKLM, strKeyPath + keyItem, "DisplayName", sValue)
Line 39: If sValue Is DBNull.Value Then
Line 40: Response.Write("The registry key does not exist.")

Stack Trace:

[COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +977
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +214
_Default.GetSoftwareInfo() in C:\Documents and Settings\xxx\My Documents\Visual Studio 2005\WebSites\Siras\Default.aspx.vb:38
_Default.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\xxx\My Documents\Visual Studio 2005\WebSites\Siras\Default.aspx.vb:14
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4919


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
 
Last edited by a moderator:

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
First, why are you using a COM component to retrieve values from the registry? The .NET framework contains classes that make this fairly simple.

Second, why are you retrieving values from the registry? This is not a common occurrence for a web app.
 
Top Bottom