Twitterèªè¨¼å¾ã®ã³ã¼ã«ããã¯å URLãªã©ãèªãµã¤ãã®URLãæå®ãããã¨ãããã¨æãã¾ãã
Web.configã«ãã©ã¡ã¼ã¿ã¨ãã¦ç»é²ããã¨ããåæãããã¾ãããç°å¢ãä½ã度ã«è¨å®ãå¿ è¦ãªã®ã§é¢åã§ãããããªããç°¡åãªæ¹æ³ãªãããªã¼ã¨ããã®ã§ãããªæãã§ãã£ã¤ãã¦ã¿ã¾ããã
Request.Urlã使ã
Controllerã¯ã©ã¹ã®Request.Urlã使ããã¨ã«ãã¾ããããã¡ãããHTTPãªããHTTPSã§ã®è¦æ±ããªãã¨ä½¿ãã¾ããã
Urlï¼Uriã¯ã©ã¹ï¼ã®æ å ±ã¯ä¸è¨ãåç §ãã¦ä¸ããã
ãã®ï¼
Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, "");
AbsoluteUriã«ã¯http://mydomain.com:63543/Candidate/Timeline?userId=4e30969c
ã®ãããªå¤ãæ ¼ç´ããã¦ããã®ã§ã
PathAndQueryã«æ ¼ç´ããã¦ãã/Candidate/Timeline?userId=4e30969c
ã®å¤ã§ç½®ãæãã¦ããã°â¦ã¨ããæãã
ã¡ãã£ã¨ãã£ã¤ãæãã²ã©ãã§ããã
ãã®ï¼
string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority);
Schemeã§ã¯httpçã®ã¹ãã¼ã åããAuthorityã«ã¯mydomain.com:63543
ã¨ãã£ããµã¼ãåã¨ãã¼ãçªå·ãåå¾ã§ãã¾ãã®ã§ãããç¹ãã¦ãããæãã
ãããªãã¾ãããããªã¼ã¨ããã®ã§ãã£ã¡ã使ããã¨ã«ãã¾ããã
ææ
ãã£ã¨ãã£ã¨ããããæ¹ãããã¯ããããããªå°ç´°å·¥ããã§ããã使ãããçãª
追è¨(10/4)ãããããã¹ããªæ¹æ³ã ã¨æã
@haxeãããæãã¦ããã¾ããããããã¨ããããã¾ãã
@nakaji GetComponents()ãããªãã®ããã¼
— ã¯ãï½â (@haxe) 2014å¹´10æ3æ¥
Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.UriEscaped);
— ã¯ãï½â (@haxe) 2014å¹´10æ3æ¥
ã¡ããã¨ã¡ã½ãããç¨æããã¦ãããã§ããã
ãã£ãããã¾ããï¼