Following are the steps to deploy
1>Create a new class library(name it as "PrefillLibrary") in visual studio .net.
2>Add reff to Shdocvw.dll and Microsoft.mshtml
3>Change name of class1.cs to PrefillUtility.cs.
Add these lines:
using mshtml;
using
SHDocVw;
4>Add following function in that class.
public String executeMSIE()
{
StringBuilder sb = new StringBuilder();
IShellWindows sh = new ShellWindows();
IEnumerator en = sh.GetEnumerator();
IWebBrowser2 ie;
IHTMLDocument2 doc;
while(en.MoveNext())
{
ie = (IWebBrowser2)en.Current;
if (ie != null)
{
doc = (IHTMLDocument2)ie.Document;
if (doc != null)
{
sb.Append(doc.url);
sb.Append("<BR>");
}
}
}
if (sb != null)
return sb.ToString();
else
return "No MSIE windows?";
}
5>Add a HTML page to the class library
6>Place this HTML in bin directory of ur project.
7>Add following code in HTML. inside <HTML> tag:
<head>
<script language="javascript">
function runExecuteMSIE()
{
var temp = PrefillLibrary1.executeMSIE();
alert(temp);
}
</script>
</head>
<body>
<p>Prefill Library<br>
<br>
<OBJECT id="PrefillLibrary1" height="250" width="500" classid="http:PrefillLibrary.dll#PrefillLibrary.PrefillUtility"
VIEWASTEXT>
</OBJECT>
<br>
<input type="button" value="Execute MSIE" onclick="runExecuteMSIE()">
<br>
<br>
</p>
</body>
8>Map the whole project folder to IIS.
9>Browse the HTML Page from IIs.
After this I am getting the exception "Permission denied".
Please let me know if there is any alternatiove for this. My main purpose is to get all the URLs running on the client's machine.