Is there a way to detect the AD credentials of a user and use them to create a NetworkCredential object that can be used to query a webservice? An excerpt of my code is below, basically I'm querying a GIS database through a webservice and the webservice requires Windows AD authentication.
Currently this is a manual process and so we just hardcode our own AD credentials into the variables up top and it works fine but I'd like the page the detect someone's AD credentials and use them to create the NetworkCredential object so we can have our internal customers use the page as well.
Public Function getJSON(ByVal url As String) As String
Dim HTMLSource As String = ""
Dim Request As WebRequest = WebRequest.Create(url)
Request.Credentials = New NetworkCredential(username, password, domain)
Dim Response As WebResponse = Request.GetResponse
Dim SR As StreamReader
SR = New StreamReader(Response.GetResponseStream)
HTMLSource = SR.ReadToEnd
SR.Close()
Return HTMLSource
End Function