473,545 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running Client Side C# Using ASP.NET

Hi guys!

I found a great article a while ago about how to write client side C#.
Sadly, I can't find it again now, but here's the jist of what I learnt
to do:

1. Write a C# (or any .NET language) dll.
2. Write a web page in ASP.NET.
3. Put the dll from 1 into the virtual directory that 2 lives in (the
root).
4. Use an object tag in the web page to download the dll onto the
client machine when the page loads.
5. Fire some javascript from within the web page to access methods in
the dll client side, effectively running code from 1 on the client,
with no need for post backs etc...

This sounds too good to be true, right? It really does work! There is
an obvious draw back: The client needs to have the .NET framework
installed! This is obviously a problem if you want to expose your
functionality across the whole of the web, but for a controlled area,
such as a company network, this method can be a great way to deploy
enhanced web applications. There's no installation needed (apart from
the framework), and if the dll mentioned in 1 is updated, the web page
automatically downloads the new version of the component. I have put
this technology to great use within my company: I have written a web
page that provides spell checking on text fields. Clearly, I don't want
to send the page back to the server every time I want to check the
spelling, so I have written a .NET dll that launches a contained form.
Text from a HTML text box is passed to the form, which checks the
spelling against a dictionary file embedded in my .NET dll. When the
form (which is displayed as modal from IE) closes, the corrected text
is put back into the HTML text box. Everything works dynamically.

Here are some technical details:

The object tag mentioned in 4 looks like this:

<OBJECT id="textEditor "
classid="http:C lientSideCode.d ll#ClientSideCo de.TextEditor" name="Text"
VIEWASTEXT></OBJECT>

Note that the classid is made up as follows: "http:{DLL File
Name}#{Default DLL namespace}.{Cla ss name}

The javascript function would then look like this:

function EditText()
{
alert(textEdito r.EditText(docu ment.Form1.txtT ext.value);
}

....assuming a control called txtText exists. Of course, the result from
this call need not be put into a message. You can do anything with the
return value, and pass a string from any source.

The method that got called in the C# dll would look something like
this:

public string EditText(string Text)
{
//Implementation
return Text;
}

However, and here is the but.... I've had this method working fine on a
whole host of machines, but every now and then I find a machine that
simply refuses to allow this method to work, even though the EXACT SAME
code works fine on other machines.

This is the message I get:

Error: Object doesn't support this property or method

I figure there must be a setting I need to tweak on these machines to
make it work, but I have no idea what I'm looking for. Can anyone
help!? I'm all out of ideas!

Thanks in advance for your help!

Steve.

Jan 21 '06 #1
5 13984
Steve,
Kudos on the post! I think I know the article you're talking about...
but I could be wrong. Is it this one?
http://msdn.microsoft.com/msdnmag/is...h/default.aspx
Also, the xml programming for .net book by Dino Esposito has an example
of using a dll from Winforms on the client. I've had a similar problem
to yours... but at a much simpler level. The code that is in the first
article runs just fine when I run it from localhost/code, but if I try
to execute the same page but by using mydomain/code it throws the same
error as the one you're getting. My guess is that it could have
something to do with security zones... and there's also sometimes (i
humbly offer) a disconnect between the control and the javascript
calling it... But if I find anything meaningful out I'll be sure to
post it here. Hope that helps...

E

Jan 21 '06 #2
Eric,

Thanks for your reply Eric, and for your kind words! The link you have
included isn't the one I was thinking about, but it is similar. I've
had the code in my example running from server to client on a LAN,
using http:\\{IP}\etc ... addresses and http:\\{server name}\etc... It
seems random as to which machines it will and won't work on at the
moment! I've even had problems running the code on a single machine
acting as both client and server, which is strange. Do you think it is
due to restrictions imposed by IIS, IE, ASP.NET, .NET Framework or the
machine itself? (That's a lot of choices!)

I suspect that my problems are security related as well; no doubt it'll
turn out to be a check box buried 10 menus deep that is missing a
check! If anyone can locate this check box (or whatever it is!) I'd be
very interested to hear what I need to do!

Cheers,

Steve.

Jan 21 '06 #3
Steve,

Did you make sure that the permissions were granted for the assembly you
are loading from the site? You have to go into the .NET Framework
Administration for the version of .NET you are running, and make sure that
the assembly that you are loading has the appropriate permissions.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<st************ *@hotmail.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.com...
Eric,

Thanks for your reply Eric, and for your kind words! The link you have
included isn't the one I was thinking about, but it is similar. I've
had the code in my example running from server to client on a LAN,
using http:\\{IP}\etc ... addresses and http:\\{server name}\etc... It
seems random as to which machines it will and won't work on at the
moment! I've even had problems running the code on a single machine
acting as both client and server, which is strange. Do you think it is
due to restrictions imposed by IIS, IE, ASP.NET, .NET Framework or the
machine itself? (That's a lot of choices!)

I suspect that my problems are security related as well; no doubt it'll
turn out to be a check box buried 10 menus deep that is missing a
check! If anyone can locate this check box (or whatever it is!) I'd be
very interested to hear what I need to do!

Cheers,

Steve.

Jan 21 '06 #4
Nicholas,

Thanks for the advice! However, could you be a bit more specific about
which settings I need to change please? I've had a look through the
..NET Configuration security settings, and there are a lot of options to
play with!

Steve.

Jan 22 '06 #5
Nicholas,

I don't know if you saw my last message, but I still can't get this
thing working on my machine at home! Could you suggest which settings I
look at changing please. Are we talking IIS, .NET Framework or
something else?!

Thanks a lot!

Steve.

Feb 1 '06 #6

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

Similar topics

4
8189
by: Si | last post by:
Hi Guys I am using this code to execute an Access VBA function from ASP: strDbName = strDataSource & "data\webjobs.mdb" Set objAccess = Server.CreateObject("Access.Application") objAccess.Visible = False objAccess.OpenCurrentDatabase strDbName objAccess.Run "ASP_SkillSearch", strTable, oUpload.Form("firstname"), oUpload.Form("surname")
13
2819
by: BK | last post by:
Can someone point me to a code sample that illustrates executing long running tasks (asynchronous) from a web application in ASP.NET? I assume that Web Services might come into play at some point, but I'm not sure how to get started. For example, I have an application that, upon a user initiating through a button or link click, will go out...
3
1258
by: JezB | last post by:
Is it possible to have rich client and ASP.NET forms running side-by-side, with at least some method of communication between them (if shared memory is not viable) ?
3
1422
by: Charlie | last post by:
Hi: What technologies are available in ASP.NET for running Server side code from a JavaScript function? Thanks, Charlie
5
1150
by: Mark | last post by:
We have VS.NET 2003, .NET 1.1, and SQL Server 2000 installed locally on each of our developer workstations. We will need to keep these tools installed for maintaining old applications, but intend on developing new applications using ASP.NET 2.0, VS 2005, and SQL Server 2005. Are there any barriers in running these products side by side...
1
6003
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the browser back button, it loads the progress bar again. Any solution to this?
4
1823
by: Mr BigSmoke | last post by:
Hi All, I'm developing a website to handle some code/application version control on a intranet. I'm using cherrypy and pysvn. Everything runs quite good but i want the user to be able to checkout some projects from the server. The user(on the client side) selects a folder in his machine (i.e.: C:\Project1) and the server should checkout...
14
23124
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So, we're looking for a way to display the page with a "please wait..." message while the process is running, and then, when the process is done, update...
12
1702
by: Peter Michaux | last post by:
I'm writing a server-side web application framework using Mozilla's Rhino JavaScript engine. My two primary motivations are so I can write code on server and client sides without needing to switch gears mentally and so that the server and client can share code. The types of code sharing I know I can use immediately are form validations and...
0
7490
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...
0
7425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7935
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6009
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...
1
5351
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5069
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...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
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...

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.