RegistrationUri









How do I use Registration Uri
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: AccountService.cs Copy
59     public void RegisterByEmail(string email, Origin origin)
60     {
61         this.registrationCallback = null;
62         this.AppId = string.Empty;
63         this.Message = string.Empty;
64         this.ReturnCode = -1;
65
66         string result;
67         try
68         {
69             WebRequest req = HttpWebRequest.Create(this.RegistrationUri(email, (byte)origin));
70             HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
71
72             // now read result
73             StreamReader reader = new StreamReader(resp.GetResponseStream());
74             result = reader.ReadToEnd();
75         }
76         catch (Exception ex)
77         {
78             this.Message = "Failed to connect to Cloud Account Service. Please register via account website.";
79             this.Exception = ex;
80             return;
81         }
82
83         this.ParseResult(result);
84     }
File name: AccountService.cs Copy
93     public void RegisterByEmailAsync(string email, Origin origin, Action callback = null)
94     {
95         this.registrationCallback = callback;
96         this.AppId = string.Empty;
97         this.Message = string.Empty;
98         this.ReturnCode = -1;
99
100         try
101         {
102             HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(this.RegistrationUri(email, (byte)origin));
103             req.Timeout = 5000;
104             req.BeginGetResponse(this.OnRegisterByEmailCompleted, req);
105         }
106         catch (Exception ex)
107         {
108             this.Message = "Failed to connect to Cloud Account Service. Please register via account website.";
109             this.Exception = ex;
110             if (this.registrationCallback != null)
111             {
112                 this.registrationCallback(this);
113             }
114         }
115     }
File name: AccountService.cs Copy
161     private Uri RegistrationUri(string email, byte origin)
162     {
163         string emailEncoded = Uri.EscapeDataString(email);
164         string uriString = string.Format("{0}?email={1}&origin={2}", ServiceUrl, emailEncoded, origin);
165
166         return new Uri(uriString);
167     }

RegistrationUri 112 lượt xem

Gõ tìm kiếm nhanh...