Jump to content

can i save to MAC adrresses with ASP


bindvori

Recommended Posts

hi, my question is, how can i save MAC addreses or can i save with ASP?, i have a request form and i have blocke some clients but clients change himslef mail addresses and breaking to blocke, i thinked blocke to MAC addresses (mac ban) but i can not find to codes, can u help me pls about it. i dont have imformation and i write here. thank you for read my message and sory for my bad english because i am writing from turkiye. thnks once again. bindvori berre

Link to comment
Share on other sites

You can try this:

function GetMACAddress(strIP)GetMacAddress = ""Set net = Server.CreateObject("wscript.network")Set sh = Server.CreateObject("wscript.shell")sh.run "%comspec% /c nbtstat -A " & strIP & "|find ""MAC Address"">c:\"& strIP & ".txt",0,trueSet sh = nothingSet fso = createobject("scripting.filesystemobject")fileContents = Trim(fso.opentextfile("c:\" & strIP & ".txt").ReadLine)fso.deletefile "c:\" & strIP & ".txt"Set fso = nothingGetMacAddress = Replace(fileContents, "MAC Address = ", "")End function

Link to comment
Share on other sites

  • 1 month later...
You can try this:
function GetMACAddress(strIP)GetMacAddress = ""Set net = Server.CreateObject("wscript.network")Set sh = Server.CreateObject("wscript.shell")sh.run "%comspec% /c nbtstat -A " & strIP & "|find ""MAC Address"">c:\"& strIP & ".txt",0,trueSet sh = nothingSet fso = createobject("scripting.filesystemobject")fileContents = Trim(fso.opentextfile("c:\" & strIP & ".txt").ReadLine)fso.deletefile "c:\" & strIP & ".txt"Set fso = nothingGetMacAddress = Replace(fileContents, "MAC Address = ", "")End function

thank you very much,
Link to comment
Share on other sites

  • 1 month later...
you could get the remote IP adress<%@ language=javascript %><% =Request.ServerVariables("REMOTE_ADDR")%>http://www.w3schools.com/asp/coll_servervariables.asp
Hope you don't mind if I randomly jump in here, but that won't work cause you are declaring that the language is JavaScript, so that's like ASP and JavaScript mixed up, which would confuse the server.It should read:
<%@ Language="VBScript" %><% Option Explicit %>'some code here<%= Request.ServerVariables("REMOTE_ADDR") %>'yet more code

That should work for all computers since ASP is server side scripting :) Dug

Link to comment
Share on other sites

Actually Dug, ASP is language-independent, to an extent. Look what you're doing:<%@ Language="VBScript" %>How is making the language VBScript any different then making it Javascript? VBScript is not ASP, ASP is ASP and VBScript is VBScript, and Javascript is Javascript. You can use either Javascript or VBScript to write ASP scripts, the ASP interpreter understands both (or more specifically, Microsoft JScript and Microsoft VBScript). In fact, you can even use both languages in the same script. The first example is correct. I write all of my ASP pages using Javascript, it is a much easier and more powerful language then VBScript is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...