2011-05-05 80 views
0
want to pass session of account id through href.. i tried with 
`href="../Profile/Home.aspx?uid=<% =&Session("AccountId")%>"` 

,但其沒有工作..幫我如何通過會話變量的href

+0

試圖擺脫&? 還要確保你有會議(「accountId」)的價值 – rlee923 2011-05-05 11:59:36

+0

什麼不工作......編譯器錯誤,或者你有其他預期的輸出?只是看着你不應該有&後=的代碼。 – 2011-05-05 12:00:14

回答

2

嘗試:

href="../Profile/Home.aspx?uid=<%= Session["AccountId"] %>" 

你在那裏有一個多餘的&。同時會話是用[]索引的,而不是()

+0

你不應該使用&和()..感謝它的工作 – Anboo 2011-05-05 12:10:11

+0

這是否反之亦然?例如'href =「../ Profile/Home.aspx?<%Session [」AccountId「] = 29%>'' – william 2011-10-14 05:30:27

+0

@william:您應該能夠設置會話變量,但這不是一個好主意。 – Ferruccio 2011-10-14 10:46:35