'Netsh HTTP could not register
I am using following .net code to register url :
Dim SysInfo As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()
Dim txt As String = "netsh http add urlacl http://+:6768/ user=" & SysInfo.Name
File.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Desktop & "\regwcf.bat", txt)
I run the bat file in elevated/admin mode and it registers. Usually this works fine in most Windows systems but in Windows 11 its giving error 87, parameter incorrect.
For my pc this is the output: netsh http add urlacl http://+:6768/ user=ADMIN-LAPTOP\Test User
What is wrong ?
Solution 1:[1]
Dim txt = String.Format("netsh http add urlacl http://+:6768/ user=""{0}""", SysInfo.Name)
The above code solved the problem
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Greatchap |
