的查詢字符串參數我無法從網址,以獲取查詢參數在asp.net無法獲得在asp.net
網址是:here
我的代碼是
string code = Request.QueryString["code"];
string clientid = Request.QueryString["client_id"];
我得到的代碼參數,但client_id爲空。我在這裏做錯了。
的查詢字符串參數我無法從網址,以獲取查詢參數在asp.net無法獲得在asp.net
網址是:here
我的代碼是
string code = Request.QueryString["code"];
string clientid = Request.QueryString["client_id"];
我得到的代碼參數,但client_id爲空。我在這裏做錯了。
you are use like,
string code = Request.QueryString["response_type"];
string clientid = Request.QueryString["client_id"];
你在string code = Request.QueryString["response_type"];
檢錯與此請。
我試過但沒有結果。 –
它說什麼?返回null啊? –
是yar。你能以另一種方式給我建議嗎? –
重定向URL不正確,因此重定向過程中redirect_uri
編碼從谷歌的查詢字符串參數第一&
之後將被忽略(REDIRECT_URI不應包含&
,因爲它是你必須保持它的編碼形式%26
)。
的初始URL是(包含 'CLIENT_ID'):
https://accounts.google.com/o/oauth2/auth?scope=profile%20email&state=%2Fprofile&redirect_uri=http://localhost:14772/WebForm2.aspx&response_type=code&
client_id
= 41866849709-lobbqne5v4asm7dn2fu1v8lubm6pc7e7.apps.googleusercontent.com & approval_prompt =由重定向力
但經過谷歌其不有Client_Id。
的問題是redirect_uri
內容的編碼不正確。請正確配置。它應該看起來像:
的http%3A%2F%2Flocalhost%3A14772%2FWebForm2.aspx%26response_type%3Dcode%26client_id%3D41866849709-lobbqne5v4asm7dn2fu1v8lubm6pc7e7.apps.googleusercontent.com%26approval_prompt%3Dforce
他們將代碼中的值分配給response_type.so代碼= response_type –
是不是後退了..?我的意思是,'key = value'。 '... WebForm2.aspx&response_type = code&client ...''很明顯''response_type = code'通常會說話,你的'locahost:14772'是'redirect_uri'的值,所以把它作爲查詢字符串會有點棘手。 –
嗨@BagusTesa不,它是一個動態生成的URL合成者 –