public
string
GetGscCurrentUser()
{
HttpWebRequest webRequest =
null
;
StreamReader responseReader =
null
;
try
{
string
getGscUserUrl = System.Configuration.ConfigurationManager.AppSettings[
"
GscGetUserUrl
"
];
string
urlHandler = getGscUserUrl +
"
?id=
"
+ Guid.NewGuid();
webRequest = (HttpWebRequest)HttpWebRequest.Create(urlHandler);
webRequest.Timeout =
3000
;
//
3秒超时
webRequest.PreAuthenticate =
true
;
NetworkCredential gscCred =
new
NetworkCredential(
"
account
"
,
"
***
"
);
webRequest.Credentials = gscCred;
responseReader =
new
StreamReader(webRequest.GetResponse().GetResponseStream());
string
currentUserGulid = responseReader.ReadToEnd();
return
currentUserGulid.Trim();
}
catch
{
return
""
;
}
finally
{
responseReader.Close();
responseReader.Dispose();
}
}