Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a DLL to communicate with both WEB and WINDOWS app?

Status
Not open for further replies.

nomi2000

ISP
Feb 15, 2001
676
CA
Hi Guys
I need to build a dll in .NEt which can communicate with both WEB and WINDOWS application,
depending upon the application which is calling the dll i want to store some values ,i know i can build the dll in vb .NET and call the interfaces from both application without any problem but i am stuck in a scenerio where in case of WEB i want to store some value in SESSION (MY be Property bags) in that dll which can reatain values and in case of windows i know i can use simple properties for accessing the values
so i think
1) dll should know which application its calling from i.e web or windows
2) depending upon the application its calling from set its property bags
Regards
Nouman

Nouman Zaheer
Software Engineer
MSR
 
You could create a property within the class called e.g. CallerType and require that this is set before any of the functions can be used.

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Hi crundy thanks can you give more light on this? what i was thinking is to similar but what i neeed to know is that
1) which libraray in the .Net will tell me that which application is calling that interface in the dll
2) after decieding this i can some how have to seperate code for web and windows application.but not sure how to store properties in case of web as the values will be lost if its not present in the session,or viewstate.
Regards
Nouman

Nouman Zaheer
Software Engineer
MSR
 
I think you can just create a property in your class called e.g. CalerType, and then when your web / windows apps create a new instatnce of the class they can set that first:

Dim myDLL as new yourDLL
myDLL.CallerType = "Web"

And then any other properties / methods in yourDLL can just check the value of CallerType, e.g.

public function getVar(byval varName as string) as String
Dim myValue as String
if CallerType = "Web" then
myValue = Session(varName)
else
myValue = "From somewhere else"
end if

Return myValue
End Function

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top