2011-09-15 1 views
2

요청 URL의 예 : http:\\localhost\ChatWindow.aspx?username=sly_chandan쿼리 문자열 매개 변수를 검색 할 수 없습니다.

내의 WebMethod가 아래와 같습니다 : 나는 쿼리 문자열 매개 변수를 검색 할 수없는 것

[WebMethod(EnableSession = true)] 
public static List<PrivateMessage> GetMessages() 
{ 
    List<PrivateMessage> getMsgsList = (List<PrivateMessage>)HttpContext.Current.Application["PrivateMessages"]; 
    var msgs = getMsgsList.Where(x => x.fromUsername == HttpContext.Current.Session["Username"].ToString() && x.toUsername == HttpContext.Current.Request.QueryString["username"]); 
    return msgs.ToList(); 
} 

.

[WebMethod(EnableSession = true)] 
public static List<PrivateMessage> GetMessages(string username) 
{ 
    List<PrivateMessage> getMsgsList = (List<PrivateMessage>)HttpContext.Current.Application["PrivateMessages"]; 
    var msgs = getMsgsList.Where(x => x.fromUsername == HttpContext.Current.Session["Username"].ToString() && x.toUsername == username; 
    return msgs.ToList(); 
} 
+0

어쩌면 당신이 || 의미 : – onof

답변

1

가 쿼리 문자열을 얻으려면, 당신은 단순히 같이 귀하의 방법을 변경 할 수 있어야한다 대신에 &&