Click here to Skip to main content
15,890,897 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: cryatal report Pin
Christian Graus20-Aug-09 1:30
protectorChristian Graus20-Aug-09 1:30 
GeneralRe: cryatal report Pin
mylogics20-Aug-09 1:10
professionalmylogics20-Aug-09 1:10 
Questionaspmenu boreder collapse problem Pin
Mogamboo_Khush_Hua19-Aug-09 22:43
Mogamboo_Khush_Hua19-Aug-09 22:43 
QuestionTo make a list of categories with datalist or any other control Pin
brijmohansingh1019-Aug-09 22:08
brijmohansingh1019-Aug-09 22:08 
AnswerRe: To make a list of categories with datalist or any other control Pin
Christian Graus19-Aug-09 23:15
protectorChristian Graus19-Aug-09 23:15 
QuestionFetching MAC address of clients machine Pin
krishnaveer19-Aug-09 22:00
krishnaveer19-Aug-09 22:00 
AnswerRe: Fetching MAC address of clients machine Pin
Abhishek Sur19-Aug-09 22:05
professionalAbhishek Sur19-Aug-09 22:05 
AnswerRe: Fetching MAC address of clients machine Pin
Aman Bhullar19-Aug-09 22:10
Aman Bhullar19-Aug-09 22:10 
ActiveX code example is
<script language="javascript">
     function showMacAddress(){
 
    var obj = new ActiveXObject("WbemScripting.SWbemLocator");
    var s = obj.ConnectServer(".");
    var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
    var e = new Enumerator (properties);

 
    var output;
    output='<table border="0" cellPadding="5px" cellSpacing="1px" bgColor="#CCCCCC">';
    output=output + '<tr bgColor="#EAEAEA"><td>Caption</td><td>MACAddress</td></tr>';
    while(!e.atEnd())

    {
        e.moveNext();
        var p = e.item ();
        if(!p) continue;
        output=output + '<tr bgColor="#FFFFFF">';
        output=output + '<td>' + p.Caption; + '</td>';
        output=output + '<td>' + p.MACAddress + '</td>';
        output=output + '</tr>';
    }

    output=output + '</table>';
    document.getElementById("box").innerHTML=output;
}
</script>


The above code will work fine for IE.

ASP based code example is as
Copy and paste the two ASPFiles below

The first ASP file- NIC5.ASP

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WMI Scripting HTML</title>

<script FOR="foo" EVENT="OnCompleted(hResult,
pErrorObject, pAsyncContext)" LANGUAGE="JScript">

             document.forms[0].txtMACAddr.value=unescape(MACAddr);
             document.forms[0].txtIPAddr.value=unescape(IPAddr);
             document.forms[0].txtDNSName.value=unescape(sDNSName);
             document.formbar.submit();
        </script>
<script FOR="foo" EVENT="OnObjectReady(objObject,
objAsyncContext)" LANGUAGE="JScript">

         if(objObject.IPEnabled != null && objObject.IPEnabled !
= "undefined" && objObject.IPEnabled == true)
                  {

                   if(objObject.MACAddress != null &&
objObject.MACAddress != "undefined")
                         MACAddr = objObject.MACAddress;


                   if(objObject.IPEnabled && objObject.IPAddress(0) !=
null && objObject.IPAddress(0) != "undefined")
                         IPAddr = objObject.IPAddress(0);

                   if(objObject.DNSHostName != null &&
objObject.DNSHostName != "undefined")
                      sDNSName = objObject.DNSHostName;

                   }
        </script>

</head>
<body>
<p>



<FONT color="red"><span
ID="info"> </span>. </FONT>
<object classid="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6" id="locator" VIEWASTEXT>
</object>
<object classid="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223" id="foo">
</object>

<script LANGUAGE="JScript">

             var service = locator.ConnectServer();
             var MACAddr ;
             var IPAddr ;
             var DomainAddr;
             var sDNSName;
             service.Security_.ImpersonationLevel=3;
             service.InstancesOfAsync
(foo, 'Win32_NetworkAdapterConfiguration');
        </script>
</p>


<form method="POST" action="NICPost.asp" id="formfoo" name="formbar">

<input type="hidden"  name="txtMACAddr">
<input type="hidden"  name="txtIPAddr">
<input type="hidden"  name="txtDNSName">

</form>


</body>
</html>

*************************
This is the second file. It is an ASP page, but you could change it to
plain HTML and use Java to retrieve the form field values, if you
wanted.

NICPost.asp

<HTML>
<HEAD>
</HEAD>
<BODY>
Network Interface Card Information Page
<BR>
<BR>
<BR>
You are at IP Address <STRONG>
<%=request.form("txtIPAddr")%>
</STRONG>
<BR>
Your MAC address on your network card is <STRONG>
<% =request.form("txtMACAddr")%>
</STRONG>
<BR>
Your DNS Host name is <STRONG>
<% =request.form("txtDNSName")%>
</STRONG>
<BR>
<BR>
<BR>
To confirm your IP and MAC address information, go to
the command prompt and
type in
<BR>
<BR>
IPCONFIG/ALL
<BR>
<BR>
ASP reports that your IP Address is <STRONG>
<%
response.Write Request.Servervariables("REMOTE_ADDR")
%>
</STRONG>which is your external WAN IP address that
anyone can see,
<BR>
but maybe be shared by hundreds of users if you use Net
Address Translation
(NAT)
<BR>
through a common router.
</BODY>
</HTML


Try using the code

Regards
Aman Bhullar
www.arlivesupport.com[^]

GeneralRe: Fetching MAC address of clients machine Pin
krishnaveer19-Aug-09 23:01
krishnaveer19-Aug-09 23:01 
GeneralRe: Fetching MAC address of clients machine Pin
krishnaveer19-Aug-09 23:15
krishnaveer19-Aug-09 23:15 
AnswerRe: Fetching MAC address of clients machine Pin
Jeremy Likness20-Aug-09 5:31
professionalJeremy Likness20-Aug-09 5:31 
QuestionHow to create a regular expression validation for numbers from 1 to 4000 ? Pin
meeram39519-Aug-09 21:45
meeram39519-Aug-09 21:45 
AnswerRe: How to create a regular expression validation for numbers from 1 to 4000 ? Pin
Abhishek Sur19-Aug-09 21:57
professionalAbhishek Sur19-Aug-09 21:57 
AnswerRe: How to create a regular expression validation for numbers from 1 to 4000 ? Pin
Coding C#19-Aug-09 23:19
Coding C#19-Aug-09 23:19 
AnswerRe: How to create a regular expression validation for numbers from 1 to 4000 ? Pin
SmartAvi20-Aug-09 5:14
SmartAvi20-Aug-09 5:14 
AnswerRe: How to create a regular expression validation for numbers from 1 to 4000 ? Pin
vaibhav.csmiet8-Mar-10 21:58
vaibhav.csmiet8-Mar-10 21:58 
GeneralRe: How to create a regular expression validation for numbers from 1 to 4000 ? Pin
meeram3959-Mar-10 1:42
meeram3959-Mar-10 1:42 
Questionaccess database Pin
KhandelwalA19-Aug-09 21:39
KhandelwalA19-Aug-09 21:39 
AnswerRe: access database Pin
Vimalsoft(Pty) Ltd19-Aug-09 21:43
professionalVimalsoft(Pty) Ltd19-Aug-09 21:43 
AnswerRe: access database Pin
Abhishek Sur19-Aug-09 22:02
professionalAbhishek Sur19-Aug-09 22:02 
GeneralRe: access database Pin
Greg Chelstowski20-Aug-09 0:57
Greg Chelstowski20-Aug-09 0:57 
GeneralRe: access database Pin
Abhishek Sur20-Aug-09 21:28
professionalAbhishek Sur20-Aug-09 21:28 
AnswerRe: access database Pin
padmanabhan N19-Aug-09 22:17
padmanabhan N19-Aug-09 22:17 
QuestionThe remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse() at WebRequest.Create Error in server environment Pin
thangavel.8119-Aug-09 21:22
thangavel.8119-Aug-09 21:22 
AnswerRe: The remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse() at WebRequest.Create Error in server environment Pin
GOPALDOT30-Dec-10 6:28
GOPALDOT30-Dec-10 6:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.