我不知道這是什麼proplem?我試圖解決它,但我沒有得到任何結果!如何從特定字符的鏈接中進行子串處理?
我的瀏覽器鏈接
http://localhost:49496/Activated.aspx?id=2
而且代碼
string uri = HttpContext.Current.Request.Url.AbsoluteUri;
int num1 = uri.IndexOf('=');
int num2=uri.Length-1;
string ID = uri.Substring(num1,num2);
錯誤說:
索引和長度必須引用位置的字符串中。 參數名稱:長度
那麼,它有什麼問題呢?
NUM2多少煤焦服用。而不是最後一個索引。 –