SharePoint 365 API

When we try to create sRequestdigest(/_api/contextinfo) before making above call, it's not allowing and throwing error like 403.

Below is part which is called to generate sRequestdigest with SharePoint365 REST API call from normal website from code.

Dim req As HttpWebRequest = WebRequest.Create(
    String.Format("{0}/_api/contextinfo", i_sSiteurl))
    req.Method = "POST"
    req.Accept = "application/json;odata=verbose"
    req.ContentLength = 0
    req.Credentials = New NetworkCredential(UID, pwd, Domain)
    response = req.GetResponse()