G
Guest
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.SecurityPermission error. This
action is initiated through Javascript by calling
USSActiveX.GetVisionInformation().
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_Zone 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="WebForm4.aspx.cs" AutoEventWireup="false"
Inherits="Test_ActiveXDotNetWeb.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript">
function doScript()
{
USSActiveX.GetVisionInformation();
Form1.hdnName.value = USSActiveX.ApplicantName;
Form1.hdnSSN.value = USSActiveX.ApplicantSSN;
Form1.hdnOTA.value = USSActiveX.OrgTypeApplicationNumber;
Form1.hdnScreen.value = USSActiveX.VisionScreen;
}
</script>
</HEAD>
<body>
<OBJECT id="USSActiveX"
classid="Unicorn.ScreenScrapeActiveX.dll#Unicorn.ScreenScrapeActiveX.ScreenScrape"
name="USSActiveX" 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"> <input
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","doScript();");
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.SecurityPermission error. This
action is initiated through Javascript by calling
USSActiveX.GetVisionInformation().
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_Zone 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="WebForm4.aspx.cs" AutoEventWireup="false"
Inherits="Test_ActiveXDotNetWeb.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript">
function doScript()
{
USSActiveX.GetVisionInformation();
Form1.hdnName.value = USSActiveX.ApplicantName;
Form1.hdnSSN.value = USSActiveX.ApplicantSSN;
Form1.hdnOTA.value = USSActiveX.OrgTypeApplicationNumber;
Form1.hdnScreen.value = USSActiveX.VisionScreen;
}
</script>
</HEAD>
<body>
<OBJECT id="USSActiveX"
classid="Unicorn.ScreenScrapeActiveX.dll#Unicorn.ScreenScrapeActiveX.ScreenScrape"
name="USSActiveX" 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"> <input
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","doScript();");