-3
下面這行拋出NullRefrenceException
:MD5.Create()拋出NullRefrence
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void newUser(string name, string password,string email)
{
var db = new ORMDataContext();
var user = new User();
Console.Write(password);
user.email = email;
user.password = MD5.Create(password).ToString();
user.username = name;
db.Users.InsertOnSubmit(user);
db.SubmitChanges();
this.Context.Response.ContentType = "application/json; charset=utf-8";
this.Context.Response.Write(JsonConvert.SerializeObject(user.Id));
}
我檢查和密碼不爲空,螺母莫名其妙MD5-ING返回空。
'user == null'? –
讓我把整個方法 –
我認爲你可以通過調試很容易地找出哪一個是空的...... –