473,653 Members | 3,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using ATL COM DLL in Web-Based application (Visaul C# and ASP.NET)

Hi All,

My requirement: I want to use TestDll.dll(ATL COM DLL, Threading Model -
Apartment, Interface - Dual and Aggregation - Yes) in ASPX pages.

I created type library for TestDll.dll (ATL COM DLL) using tlbimp
from VS2005 command prompt. Output is TESTDLLLib.lib( .NET Assembly). It has
only one function which is CreateFileInCDr ive(). It just creates one text
file in C
Drive.
code snippet:
STDMETHODIMP CMyTest::Create FileInCDrive()
{
// TODO: Add your implementation code here
FILE* fp = fopen("C:\\Test Dll.txt","w");
if (fp != NULL)
{
fprintf(fp,"%s" ,"welcome\n" );
fclose(fp);
}

return S_OK;
}

I created asp.net website project and selected code behind as visual c#. I
would like to use atl com dll (TestDll.dll) in Page_Load event. Is it
possible?

In Visual C#, (i mean page_load function) I am able to create object.
But, I cannot create the TestDll.txt file.

I can use this TESTDLLLib.lib in Visual C# Console application. But, it is
now working fine in asp.net with visual C# application. What might be the
problem?

Please suggest me.

Is it correct approach?

--
Thanks & Regards,
John.

Apr 4 '07 #1
1 1558
John wrote:
Hi All,

My requirement: I want to use TestDll.dll(ATL COM DLL, Threading Model -
Apartment, Interface - Dual and Aggregation - Yes) in ASPX pages.

I created type library for TestDll.dll (ATL COM DLL) using tlbimp
from VS2005 command prompt. Output is TESTDLLLib.lib( .NET Assembly). It has
only one function which is CreateFileInCDr ive(). It just creates one text
file in C
Drive.
code snippet:
STDMETHODIMP CMyTest::Create FileInCDrive()
{
// TODO: Add your implementation code here
FILE* fp = fopen("C:\\Test Dll.txt","w");
if (fp != NULL)
{
fprintf(fp,"%s" ,"welcome\n" );
fclose(fp);
}

return S_OK;
}

I created asp.net website project and selected code behind as visual c#. I
would like to use atl com dll (TestDll.dll) in Page_Load event. Is it
possible?

In Visual C#, (i mean page_load function) I am able to create object.
But, I cannot create the TestDll.txt file.

I can use this TESTDLLLib.lib in Visual C# Console application. But, it is
now working fine in asp.net with visual C# application. What might be the
problem?

Please suggest me.

Is it correct approach?
Sounds like something trivial - write permission for the web app or
something like this. By the way - why didn't you do the standard
approach - with [DllImport("Test Dll.dll")] + wrapper function and etc...

HTH
Petar,
http://a-wake.net
Apr 4 '07 #2

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

Similar topics

3
2490
by: none | last post by:
Hi. I'm implementing a web deployment using 9i. I have a table for STOCK, which has one or more PURCHASES, which have one or more PURCHASE_ITEMS. When a purchase item is INSERTED, I'd like the web module component to update the relevant grandparent record of STOCK, and when UPDATED, to remember the previous level and adjust accordingly. I'm sure that this can probably be done in PL/SQL, but don't have a clue how - all books and...
3
8505
by: clintonG | last post by:
Briefly stated, my problem is accessing and 'setting' properties of a label control declared in the template of another control noting that the other control is an instance of the beta 2 DetailsView control which supports a PagingTemplate. Somewhere I grabbed some declarations for a PagerTemplate to display paging as: <<First < Prev Next> Last>>
6
1988
by: Serious_Practitioner | last post by:
Good day all, and thank you in advance for your help. No - MANY thanks in advance for your help - I know nothing about using databases on Web servers. I am about to discuss a project with a client who is in the apartment rental business. He solicits "For Rent" listings from property owners and managers, advertises the apartments, shows them, takes applications and like that. His inventory, as it were, is a list of vacant apartments that...
3
1474
by: Charles Stanley | last post by:
Hi all, I'm new to C#, and have two pretty simple questions: I have a class, in a .cs file by itself. I need to make use of the sole function in this class in another .cs file. Here's the code, filename bannertrack.cs First question - the function "LogImpr" users ServerVariables + "')"; The compiler tells me that this is not included in the namespace. ??
1
1636
by: Stephen Adam | last post by:
Hi there, I've just started a c# project at work where I cannot use Visual Studio. I am trying to pass variables from one form to another. When I try to create an instance of the sending class in the receiving class I get a "The type or namespace name 'XXXX' could not be found (are you missing a using directive or an assembly reference?)" Error. It seems that even though the sending class resides in the same folder as the receiving...
0
1552
by: khubieb | last post by:
Simply I am trying to use RSACryptoServiceProvider to generate a key pair, send the public key to a service that will retrieve me data, encrypt it with my public key, send the encrypted data back for me to decrypt the data and use it. below is a code sample that simulates my task. It works just fine, however, when I turn impersonation to true in my web.config file and after a random number of attempts to invoke my page, an unhandled...
0
2558
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
1
2994
by: nyathancha | last post by:
Hi, I am using WSE to implement security using x509 certificates. This works when I use a windows client but throws an exception when I use NUnit. My Code looks as follows : UsernameToken myCurrentToken = new UsernameToken("xxxx", "YYY", PasswordOption.SendPlainText); MyServicesWse adminServices = new MyServicesWse();
21
34382
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
0
4922
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I want to call RDP on Page load and it is working fine.My code is in C#. But I am unable to perform following functions 1. when i disconnected from RDP, i want to go back to previous page 2. If RDP is opened in fullscreen mode, then onconnected, i want to go back to previous page.
0
8370
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.