我面臨着以下問題:空引用異常,但加密的查詢字符串
我進行加密,然後我的查詢字符串編碼的結果,所以我得到url
這樣的:
PageDetail.aspx?enc=LFgzoz6LxQ54RaOMuZCJlluim9oH%2fRW2bpGJEo3rZ7E1Y8ixg9vbHRRc2koFdqbK%2f5PS%2fIv1v%2b3N%2beLwXJMtpdTOEwqwZLoTkh%2bIPW1S4f4764i3MY%2f9AECdSNmIgeaSovpJouXp3bQi4ntOyJOzW4eXawpAvS3gGvPWQLsr0My9NcAd5PT5Qwr2vVOfzjAYc%2f%2f1AdseguQUyWX7sIPK%2fPGYxLmjU204I2bGS%2f8%2fSPCXp4fZfbfJIaafBmSFbRhXAb%2fneWQFb83PzcP7Ljk9o90qMAeVuRvwhAcy6IsPmW76OpwT8JRK8Vw%2fTrmoSDmNCMYN1VuCm%2fT6fvg1mbiruqmPnDoKXr8zR2ChY1zev8leWHWPDmn572Hi02w6nu4vamOSlgIvH2LNEHUYYtIITX1DH%2bSagIl%2fuiNtWsQsdrqd%2b31ksO8GVYuJcAnn7%2fcST4w5Fzs3JPO2cPwiMeXDQw%3d%3d
然後我嘗試解密結果: 但當我嘗試通過查詢字符串:
Request.QueryString["enc"]
我得到空引用異常我不知道爲什麼?
你可以張貼堆棧跟蹤?或嘗試請求[「enc」]。 – Habibillah
我收到相同的異常: '在UI.PageDetail.Page_Load(Object sender,EventArgs e)in F:\ ... \ UI \ PageDetail.aspx.cs:line 29 at System.Web.Util.CalliHelper .EventArgFunctionCaller(IntPtr fp,Object o,Object t,EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)' –
您可能嘗試訪問頁面某一點的Request對象生命週期,當它尚不存在或已被銷燬時。 – wizzardmr42