473,562 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find Window from Client-Side (ActiveX?) to Copy Contents into Web

Hello,

I'm running an asp.net, intranet web application using .net framework 1.1 on
IIS5.1 / 6.0. Through the web application, I would like to press a button on
the web page, have another window (not web-based or part of current
application) brought to the front and focused (findwindow api) and have the
button scrape the contents of the focused window so the contents can be
parsed and entered into the web application.

Ideally, I would like to do this server-side, but I don't think I can get to
a window on the client's pc to bring it to the front. I'm definitely open to
javascript since this is an intranet application and the environment is
controlled.

I've considered and attempted to create an ActiveX control that will be in a
web page (object tag). The class library project contains an interface,
IScreenScrape, that defines the method and properties available (COM
support?). If I run the ActiveX control and exit before it attempts to
"activate" the other application's window, the properties are accessible and
contain values, and the process finishes successfully. The ActiveX control
seems to work until it attempts to "activate" the other application's window
where I get a System.Security .Permissions.Se curityPermissio n error. This
action is initiated through Javascript by calling
USSActiveX.GetV isionInformatio n().

Things I've tried:
1) I've added my local pc to the "Trusted Sites" in IE 7;
2) I've modified code-access security in LocalIntranet_Z one to FullTrust and
Everything;
3) I've strong-name signed the dll that houses the ActiveX control (when I
did this, I started getting a Javascript error indicating "object does not
support this property or method" even though it exists).

Any help that can be provided is appreciated. Thanks.

Web Application calling code:

<%@ Page language="c#" Codebehind="Web Form4.aspx.cs" AutoEventWireup ="false"
Inherits="Test_ ActiveXDotNetWe b.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<script type="text/javascript">
function doScript()
{
USSActiveX.GetV isionInformatio n();
Form1.hdnName.v alue = USSActiveX.Appl icantName;
Form1.hdnSSN.va lue = USSActiveX.Appl icantSSN;
Form1.hdnOTA.va lue = USSActiveX.OrgT ypeApplicationN umber;
Form1.hdnScreen .value = USSActiveX.Visi onScreen;

}
</script>
</HEAD>
<body>
<OBJECT id="USSActiveX "
classid="Unicor n.ScreenScrapeA ctiveX.dll#Unic orn.ScreenScrap eActiveX.Screen Scrape"
name="USSActive X" VIEWASTEXT>
</OBJECT>
<form id="Form1" method="post" runat="server">
<input type="hidden" id="hdnName" runat="server" NAME="hdnName"< input
type="hidden" id="hdnSSN" runat="server" NAME="hdnSSN">
<input type="hidden" id="hdnOTA" runat="server" NAME="hdnOTA"<i nput
type="hidden" id="hdnScreen" runat="server" name="hdnScreen ">
<br>
<input type="text" name="txt" value="Enter text here">
<br>
<asp:Button ID="butSetText " Runat="server" Text="Set Text"></asp:Button>
</form>
</body>
</HTML>

The butSetText onclick event is assigned server side using:
this.butSetText .Attributes.Add ("onclick","doS cript();");
May 15 '07 #1
3 2778
You really mean you have a managed user control, that's sthe only reason you
could get a security error. You simply need to update your cas policy with
the appropriate permissions.
--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Greg M" <Greg M@discussions.m icrosoft.comwrote in message
news:A3******** *************** ***********@mic rosoft.com...
Hello,

I'm running an asp.net, intranet web application using .net framework 1.1
on
IIS5.1 / 6.0. Through the web application, I would like to press a button
on
the web page, have another window (not web-based or part of current
application) brought to the front and focused (findwindow api) and have
the
button scrape the contents of the focused window so the contents can be
parsed and entered into the web application.

Ideally, I would like to do this server-side, but I don't think I can get
to
a window on the client's pc to bring it to the front. I'm definitely open
to
javascript since this is an intranet application and the environment is
controlled.

I've considered and attempted to create an ActiveX control that will be in
a
web page (object tag). The class library project contains an interface,
IScreenScrape, that defines the method and properties available (COM
support?). If I run the ActiveX control and exit before it attempts to
"activate" the other application's window, the properties are accessible
and
contain values, and the process finishes successfully. The ActiveX control
seems to work until it attempts to "activate" the other application's
window
where I get a System.Security .Permissions.Se curityPermissio n error. This
action is initiated through Javascript by calling
USSActiveX.GetV isionInformatio n().

Things I've tried:
1) I've added my local pc to the "Trusted Sites" in IE 7;
2) I've modified code-access security in LocalIntranet_Z one to FullTrust
and
Everything;
3) I've strong-name signed the dll that houses the ActiveX control (when I
did this, I started getting a Javascript error indicating "object does not
support this property or method" even though it exists).

Any help that can be provided is appreciated. Thanks.

Web Application calling code:

<%@ Page language="c#" Codebehind="Web Form4.aspx.cs"
AutoEventWireup ="false"
Inherits="Test_ ActiveXDotNetWe b.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<script type="text/javascript">
function doScript()
{
USSActiveX.GetV isionInformatio n();
Form1.hdnName.v alue = USSActiveX.Appl icantName;
Form1.hdnSSN.va lue = USSActiveX.Appl icantSSN;
Form1.hdnOTA.va lue = USSActiveX.OrgT ypeApplicationN umber;
Form1.hdnScreen .value = USSActiveX.Visi onScreen;

}
</script>
</HEAD>
<body>
<OBJECT id="USSActiveX "
classid="Unicor n.ScreenScrapeA ctiveX.dll#Unic orn.ScreenScrap eActiveX.Screen Scrape"
name="USSActive X" VIEWASTEXT>
</OBJECT>
<form id="Form1" method="post" runat="server">
<input type="hidden" id="hdnName" runat="server" NAME="hdnName"< input
type="hidden" id="hdnSSN" runat="server" NAME="hdnSSN">
<input type="hidden" id="hdnOTA" runat="server" NAME="hdnOTA"<i nput
type="hidden" id="hdnScreen" runat="server" name="hdnScreen ">
<br>
<input type="text" name="txt" value="Enter text here">
<br>
<asp:Button ID="butSetText " Runat="server" Text="Set Text"></asp:Button>
</form>
</body>
</HTML>

The butSetText onclick event is assigned server side using:
this.butSetText .Attributes.Add ("onclick","doS cript();");

May 16 '07 #2
Thanks for your response Alvin.

What permissions do I give it? I tried SecurityPermiss ion to no avail. I
tried to give the LocalIntranet_Z one both FullTrust and Everything and that
didn't work. Is there some sort of Win32Permission to give the assembly?

The code I'm working with is in a Class Library DLL, not a UserControl. Do I
need to move it into a UserControl? I don't intend for any user interface
components to be on the web page (at least not visible)... I just want to be
able to have the user push a button which will then instantiate the ActiveX
to scrape data from another window for use in the web app.

Thanks.
Greg

"Alvin Bruney [MVP]" wrote:
You really mean you have a managed user control, that's sthe only reason you
could get a security error. You simply need to update your cas policy with
the appropriate permissions.
--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Greg M" <Greg M@discussions.m icrosoft.comwrote in message
news:A3******** *************** ***********@mic rosoft.com...
Hello,

I'm running an asp.net, intranet web application using .net framework 1.1
on
IIS5.1 / 6.0. Through the web application, I would like to press a button
on
the web page, have another window (not web-based or part of current
application) brought to the front and focused (findwindow api) and have
the
button scrape the contents of the focused window so the contents can be
parsed and entered into the web application.

Ideally, I would like to do this server-side, but I don't think I can get
to
a window on the client's pc to bring it to the front. I'm definitely open
to
javascript since this is an intranet application and the environment is
controlled.

I've considered and attempted to create an ActiveX control that will be in
a
web page (object tag). The class library project contains an interface,
IScreenScrape, that defines the method and properties available (COM
support?). If I run the ActiveX control and exit before it attempts to
"activate" the other application's window, the properties are accessible
and
contain values, and the process finishes successfully. The ActiveX control
seems to work until it attempts to "activate" the other application's
window
where I get a System.Security .Permissions.Se curityPermissio n error. This
action is initiated through Javascript by calling
USSActiveX.GetV isionInformatio n().

Things I've tried:
1) I've added my local pc to the "Trusted Sites" in IE 7;
2) I've modified code-access security in LocalIntranet_Z one to FullTrust
and
Everything;
3) I've strong-name signed the dll that houses the ActiveX control (when I
did this, I started getting a Javascript error indicating "object does not
support this property or method" even though it exists).

Any help that can be provided is appreciated. Thanks.

Web Application calling code:

<%@ Page language="c#" Codebehind="Web Form4.aspx.cs"
AutoEventWireup ="false"
Inherits="Test_ ActiveXDotNetWe b.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<script type="text/javascript">
function doScript()
{
USSActiveX.GetV isionInformatio n();
Form1.hdnName.v alue = USSActiveX.Appl icantName;
Form1.hdnSSN.va lue = USSActiveX.Appl icantSSN;
Form1.hdnOTA.va lue = USSActiveX.OrgT ypeApplicationN umber;
Form1.hdnScreen .value = USSActiveX.Visi onScreen;

}
</script>
</HEAD>
<body>
<OBJECT id="USSActiveX "
classid="Unicor n.ScreenScrapeA ctiveX.dll#Unic orn.ScreenScrap eActiveX.Screen Scrape"
name="USSActive X" VIEWASTEXT>
</OBJECT>
<form id="Form1" method="post" runat="server">
<input type="hidden" id="hdnName" runat="server" NAME="hdnName"< input
type="hidden" id="hdnSSN" runat="server" NAME="hdnSSN">
<input type="hidden" id="hdnOTA" runat="server" NAME="hdnOTA"<i nput
type="hidden" id="hdnScreen" runat="server" name="hdnScreen ">
<br>
<input type="text" name="txt" value="Enter text here">
<br>
<asp:Button ID="butSetText " Runat="server" Text="Set Text"></asp:Button>
</form>
</body>
</HTML>

The butSetText onclick event is assigned server side using:
this.butSetText .Attributes.Add ("onclick","doS cript();");


May 16 '07 #3
Use the .net configuration console application (mscorcfg.msc at a Visual
Studio command prompt). Right click on the evaluate assembly node found in
my computer node. Find your dll. It tells you where the application will be
run from and what permissions it needs.

Actually there is a better, simpler way. Run the application and wait for it
to choke. Open your browser, and find the temporary file. Look for a
fusionlog file in the list of temporary file. Open that file in notepad by
dragging it into notepad. That file is a stack dump of the permissions
error. The stack dump tells you which permission is missing. Add that
permission to your cas policy (1st paragraph). Reset IIS you should be all
set. I have an article about this on MSDN but i forget where it is. google
if you feel lucky.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
https://www.microsoft.com/MSPress/books/10933.aspx
OWC Black Book www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Greg M" <Gr***@discussi ons.microsoft.c omwrote in message
news:DA******** *************** ***********@mic rosoft.com...
Thanks for your response Alvin.

What permissions do I give it? I tried SecurityPermiss ion to no avail. I
tried to give the LocalIntranet_Z one both FullTrust and Everything and
that
didn't work. Is there some sort of Win32Permission to give the assembly?

The code I'm working with is in a Class Library DLL, not a UserControl. Do
I
need to move it into a UserControl? I don't intend for any user interface
components to be on the web page (at least not visible)... I just want to
be
able to have the user push a button which will then instantiate the
ActiveX
to scrape data from another window for use in the web app.

Thanks.
Greg

"Alvin Bruney [MVP]" wrote:
>You really mean you have a managed user control, that's sthe only reason
you
could get a security error. You simply need to update your cas policy
with
the appropriate permissions.
--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Greg M" <Greg M@discussions.m icrosoft.comwrote in message
news:A3******* *************** ************@mi crosoft.com...
Hello,

I'm running an asp.net, intranet web application using .net framework
1.1
on
IIS5.1 / 6.0. Through the web application, I would like to press a
button
on
the web page, have another window (not web-based or part of current
application) brought to the front and focused (findwindow api) and have
the
button scrape the contents of the focused window so the contents can be
parsed and entered into the web application.

Ideally, I would like to do this server-side, but I don't think I can
get
to
a window on the client's pc to bring it to the front. I'm definitely
open
to
javascript since this is an intranet application and the environment is
controlled.

I've considered and attempted to create an ActiveX control that will be
in
a
web page (object tag). The class library project contains an interface,
IScreenScrape, that defines the method and properties available (COM
support?). If I run the ActiveX control and exit before it attempts to
"activate" the other application's window, the properties are
accessible
and
contain values, and the process finishes successfully. The ActiveX
control
seems to work until it attempts to "activate" the other application's
window
where I get a System.Security .Permissions.Se curityPermissio n error.
This
action is initiated through Javascript by calling
USSActiveX.GetV isionInformatio n().

Things I've tried:
1) I've added my local pc to the "Trusted Sites" in IE 7;
2) I've modified code-access security in LocalIntranet_Z one to
FullTrust
and
Everything;
3) I've strong-name signed the dll that houses the ActiveX control
(when I
did this, I started getting a Javascript error indicating "object does
not
support this property or method" even though it exists).

Any help that can be provided is appreciated. Thanks.

Web Application calling code:

<%@ Page language="c#" Codebehind="Web Form4.aspx.cs"
AutoEventWireup ="false"
Inherits="Test_ ActiveXDotNetWe b.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<script type="text/javascript">
function doScript()
{
USSActiveX.GetV isionInformatio n();
Form1.hdnName.v alue = USSActiveX.Appl icantName;
Form1.hdnSSN.va lue = USSActiveX.Appl icantSSN;
Form1.hdnOTA.va lue = USSActiveX.OrgT ypeApplicationN umber;
Form1.hdnScreen .value = USSActiveX.Visi onScreen;

}
</script>
</HEAD>
<body>
<OBJECT id="USSActiveX "
classid="Unicor n.ScreenScrapeA ctiveX.dll#Unic orn.ScreenScrap eActiveX.Screen Scrape"
name="USSActive X" VIEWASTEXT>
</OBJECT>
<form id="Form1" method="post" runat="server">
<input type="hidden" id="hdnName" runat="server" NAME="hdnName"< input
type="hidden" id="hdnSSN" runat="server" NAME="hdnSSN">
<input type="hidden" id="hdnOTA" runat="server" NAME="hdnOTA"<i nput
type="hidden" id="hdnScreen" runat="server" name="hdnScreen ">
<br>
<input type="text" name="txt" value="Enter text here">
<br>
<asp:Button ID="butSetText " Runat="server" Text="Set
Text"></asp:Button>
</form>
</body>
</HTML>

The butSetText onclick event is assigned server side using:
this.butSetText .Attributes.Add ("onclick","doS cript();");



May 17 '07 #4

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

Similar topics

0
1745
by: Glynn Johnson | last post by:
I understand that there is no way to upload multiple files using ASP and COM+ without having multiple form elements like <input type='file'>. I also understand that there is no way to programmatically set the value of <input type='file'> in IE because it poses a security risk. I didn't know these two facts before I tried to create a...
2
2269
by: Stephanie Stowe | last post by:
Hi. I have never worked on a project that requires IE. So I have done the vast majority of my work server side, delivering cross-browser compliant HTML to the client. I am working on a bug fix to a system that is a munch of ASP, ASP.NET with hard-core client side JScript, VBScript (client-side) and ActiveX controls. The problem in question...
4
1581
by: Marcel Brekelmans | last post by:
Hi, This is my situation: My ISP doesn't allow me the execute server-code. So, no ASP or otherwise.As a small compensation, they run some CGI scripts that we can use. With one of these scripts I maintain a set of counters, one on each of my HTML pages that they host. It is all very basic, the files are no more then textfiles that ONLY...
4
1707
by: Support | last post by:
Hello: I wrote a vb6 "client-side" ActiveX Component that will extract the user's network login. Now I want to be able to do some server-side work with this info, and it would be great if I could put the user's network login into a session variable but serverside-code is executed first .... My objective is for, each time (or the first...
5
3876
by: ESPN Lover | last post by:
I need a good primer in how to program an ActiveX control that is launched client side to communicate with the server. I've read thru three C# books and none of them even touch on the subject. I've searched web sites and found nothing. Is client side ActiveX programs on the way out? Is there any online examples of how to code an ActiveX...
12
2974
by: ShepardBerry | last post by:
This may be a dumb question, but I'm not finding anything specifically what I'm looking for. Still kind of new to .NET as well. What I'm trying to do that I know I could do in VB6.0/ASP is to create a client side object set some properties and have it run some code. I know that in VB6/asp it was fairly straight forward by creating an...
3
1200
by: Scott Friedrich | last post by:
We have an asp.net application in which we use an embedded activeX control to display an EMF. The control offers a client-side Copy method that copies the contents to the client's clipboard. Is there a way we can then stream this contents back to the server to be saved as a flat file or used to be embedded into a PDF? Thanks,
1
1317
by: haanmaum | last post by:
Dear All, I want to connect client-side (my PC) file with a specific server-side(My web server) Webpages. In vbscript, some infomation of client-side is accessible (for example; Browser info,...), but I don't know about files of client-side. In ASP, FSO is server-side file object. How can I do? I hope someones' help.
6
9486
by: dinoo | last post by:
Hi, I would appreciate if some one could help me out. I have to read a client side ini file in Aspx page and use that data in server side processing. Can any one help me out here? Please refer to a link if possible. Thanks, Dinoo
4
1472
by: Jon Slaughter | last post by:
How do I go about accessing some client side control? I'm trying to design a web site in asp.net(well, I want to but I'm seeing that JSP might be better. I don't like java but I do like the fact that JSP is portable and supposedly have better features than ASP). Anyways, My web site needs to get some files from the client side and compute...
0
7648
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
7573
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
7931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6213
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
5473
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
5189
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...
1
2069
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
1184
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
897
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.