473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Loading remote assembly throws Cast Exception

I maintain a Sql Server database application whose forms are compiled
in a .dll and kept in a remote web folder. The main .exe looks to the
web folder to see if this .dll exists. If so, then it compares the
..dll with the cache copy. If the cache copy is older then it downloads
a new copy. If the .dll is not present, it throws an error.

In my main .exe, I need to early bind my "Main" form from my
FormsLibrary.dll to get data into it. If I run my application by
loading the .dll from my local /bin folder, it works. When I run the
application by loading the .dll from the web folder, it fails, saying
there was a Cast Exception. The two .dlls are synonymous because I
copy the .dll from my local directory to the web folder.
Still, there is a version conflict.

How do I resolve this cast problem?

My code follows:

Try
Dim MyPermission As New
Permissions.FileIOPermission(Security.Permissions. PermissionState.Unrestricted)

MyPermission.Demand()

'download assembly from a web server over HTTP
Dim sLocation As String
sLocation = "HTTP://gabriel/ems/FormsLibrary.dll"

Dim formAsm As [Assembly] = [Assembly].LoadFrom(sLocation)

'get the form from the assembly
Dim formType As Type
formType = formAsm.GetType("FormsLibrary.frmMain")

'create an instance of the form
Dim formObj As Object
formObj = Activator.CreateInstance(formType)

'cast it to a form object to enable early binding and show
the form

**** LINE BELOW THROWS EXCEPTION WHEN REFERRING TO WEB FOLDER
..DLL
'FormsLibrary is my remote .dll

Dim frmMain As FormsLibrary.frmMain = CType(formObj,
FormsLibrary.frmMain)

frmMain.FormsLibraryVersion =
formAsm.GetName.Version.ToString

frmMain.ShowDialog()
Catch exc As Exception
Throw exc
End Try
Jul 21 '05 #1
0 1866

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kent Rollins | last post by:
I am writing a server and an MMC console app that use remoting to talk to each other. The MMC client and the server share a couple of assemblies: one has the interface that is remoted from the...
4
by: Aashish Patil | last post by:
Hi, My code is trying to load an assembly using Assembly.Load(string assemblyName); Assume that the current executing assembly is called Test.dll The following code works fine
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
0
by: Brent | last post by:
I maintain a Sql Server database application whose forms are compiled in a .dll and kept in a remote web folder. The main .exe looks to the web folder to see if this .dll exists. If so, then it...
0
by: Ratul | last post by:
Hi all! I'm writing a winforms test harness which lets me specify a subfolder from which to load a particular .net assembly dll. The idea is that there will be multiple subfolders, each having...
5
by: RickN | last post by:
I want to creat a new application domain called 'mydomain' and then load an assembly named 'myassembly.dll' into the domain. The assembly is in the folder "C:\Mydata\assembly", which is not the...
4
by: Abhi | last post by:
Hi All, I have a web service method which works fine when called from my local machine i.e. from localhost but when I publish the web services to a remote machine it throws an invalid cast soap...
7
by: Paul Hadfield | last post by:
Hi, I'm running into one problem with trying to call "Type.GetCustomAttributes(...)" on my reflected code. Basically - I can't trap my own custom attribute - I can only catch / identify system...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.