Showing posts with label dll. Show all posts
Showing posts with label dll. Show all posts

Monday, March 26, 2012

Object reference not set to an instance of an object

Hello,

I have a .NET DLL which I am trying to call from an ASP .NET application. The DLL errors (Object reference not set to an instance of an object) when using a function from another DLL which is instantiated once successfully.

This DLL works perfectly when called from a VB.NET application.

ASP.NET:

Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

Dim objProgram As New WCS_DLL_Interface_Girobank_Split.WCS_DLL_Interface_Girobank_Split
objProgram.Run("040927", "C:\Inetpub\wwwroot\WCS_ASP_Interface_BulkPayments\App.config")
End If
End Sub

VB.NET DLL:

'Successfully creates instance
Dim objDB As New WCS_db_authentication.db

'Loop
'Error Line
strRAN = objDB.getData_ID(strAppPath, "WCS_SP_TMP_Girobank_Split_FindDebt", strWCS_SP_TMP_Girobank_Split_FindDebt)

'End Loop

I can't see why this would work in VB.NET and not ASP.NET. It creates the object fine (Even debugging "objDB is null" returns false).

Any one any ideas?

Cheers...what is the code for WCS_db_authentication.db

Woka
Originally posted by Wokawidget
what is the code for WCS_db_authentication.db

Woka

Seems it was a problem with a database function in wcs_db_authentication after all. Didn't have the correct permissions to connect.

Thanks for the reply.

Friday, March 16, 2012

Object reference not set to an instance of an object.

Hi all,
I'm using a component in internet, which i put that .dll into my bin folder. after that I just follow the step to run the examples. However, the error come out.
Anyone can help me please?? thanks alot!!
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Bestcomy.Web.Controls.Upload.UploadModule.62aadb2cfa53b890() +51 Bestcomy.Web.Controls.Upload.UploadModule..ctor() +300[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly) +68 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) +175 System.Activator.CreateInstance(Type type, Boolean nonPublic) +61 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1091 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +113 System.Web.Configuration.ModulesEntry.Create() +39 System.Web.Configuration.HttpModulesSection.CreateModules() +218 System.Web.HttpApplication.InitModules() +161 System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1294 System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +424 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +100 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +191

Anyone can help?

Thank very much.


Can u post some of your code,
The error maybe becuase u didn use the NEW keyword to instansiate the components

As the error says a null value is getting assigned to an object! So please make sure data is there before assigning to the object!

I saw upload word in the stack, if you used for uploading (only guess), then make sure you really uploading before trying to grab value! Also make sure form attribute hasenctype="multipart/form-data"


hi, i using asp.net 2.0 so it will automatic compiled when load the page. i'm not loading the file in the default.aspx. why at the default page need to assign the upload object?