|
I think your JSON data needs to start and end with curly braces, not square brackets. So it should be something like:
{
[
{
"name": "chris",
"ic": "111111-11-1111",
"phone": "011-1111111",
"address": "street 01",
"gender": "male"
},
{
"name": "carolyn",
"ic": "222222-22-2222",
"phone": "012-2222222",
"address": "street 02",
"gender": "female"
}
]
}
And you may also need a label in front of the main array to identify it.
|
|
|
|
|
If you look at the documentation[^], or google for any example on-line, you'll see the type you supply DeserializeObject is the type you want the json to be converted to. You are saying you want the json converted to a string which makes no sense as it is already a string. So you're confusing the json parser.
Again referring to the documentation you need to create a class that represents your data and deserialise to that. So create a class like
public class Person
{
public string name { get; set; }
public string ic { get; set; }
public string address { get; set; }
public string gender { get; set; }
}
as your json is an array of these objects you was to convert it to a List<Person>
List<Person> obj = JsonConvert.DeserializeObject<List<Person>>( ... );
|
|
|
|
|
i want to update a local json file (add & remove) at server side, can anyone show me how to do it?
I pass a id parameter to determine which record i want to remove from client side to server side using ajax
$.ajax({
type: "POST",
url: "WebForm1.aspx/remove",
data: "{id:" + id+ "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
}
});
after that i had no idea how to code to modify the local file.
[System.Web.Services.WebMethod]
public static void remove(string id)
{
}
|
|
|
|
|
You can't modify files on the client from your server code.
|
|
|
|
|
How to prevent "OnSelectedIndexChanged" event triggered in DropDownCheckBoxes. When DropDownCheckBoxes Bound using asp.net?
|
|
|
|
|
How to enable Searchable dropdowncheckboxes (like AutoFilter) in asp.net
|
|
|
|
|
How to Filter the data in GridView using Linq Query without going to DataBase in VB.NET
|
|
|
|
|
|
i am not sure that always browser cache pages we visited. so my question is when browser cache web site pages? whatever site we visit browser cache each pages ?
if yes then how long browser cache each pages ?
how browser check website pages changes compared with client side cache pages ?
please help me with knowledge. thanks
|
|
|
|
|
people often load js file from CDN. what is advantage?
people said js file is cached there in CDN so load faster. so what can i do to cache js file where my site is deployed?
thanks
|
|
|
|
|
Pls Provide me business logic method for reset password or forget password by user id...
|
|
|
|
|
It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
So either pay someone to do it, or learn how to write it yourself. We aren't here to do it for you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
ohh sorry for that by the way can you provide me idea how can we implement method for that... if possible otherwise its ok! 😊
|
|
|
|
|

in order to reset password you have to give email link or else you can give direct web page link. before reset password. you should take email address from the user. so you can use in where clause. see my code:
protected void save_Click(object sender, EventArgs e)
{
if (password.Text != "" || confirmpassword.Text != "")
{
if (password.Text == confirmpassword.Text)
{
con.Open();
SqlCommand cmd = new SqlCommand("update login set password='" + password.Text + "', confirmpassword='" + confirmpassword.Text + "' where email='" + Session["email"] + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Label1.Text = "Password Reset Successfully";
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "Refresh";
meta.Content = "5;url=loginuser.aspx";
this.Page.Controls.Add(meta);
}
else
Label1.Text = "Password not Matched";
}
else
Label1.Text="Please Enter Password";
}
ask email or username. then display password reset webpage. use email or username in where clause to update password.
if you want id then use sql query like
select id from userDetails where email=session["email"];
i hope you will understand.
|
|
|
|
|
thanks, Ya I understood... you have well explained!😊
|
|
|
|
|
|
... and if you follow that advice your entire system is open to every hacker in the world.
|
|
|
|
|
yes you are right Richard.
always use parameterized query. i used this code for my college project. so i wrote like this. my suggestion also go with parameterized query to protect from sql injection.
|
|
|
|
|
And you are also storing passwords in clear text, one of the most dangerous things to do. It does not matter that you are doing this as a college project. Do it right first time and you are less likely to fall into these traps when you are doing it for real. Quite frankly if you offered that as a sample of your work in a job interview you would be discounted immediately.
|
|
|
|
|
Ya Kind of it make sense...
|
|
|
|
|
Everything about that is just so wrong.
|
|
|
|
|
Please tell me you know why this is wrong. Have a read up about subjects like SQL injection and security best practices.
This space for rent
|
|
|
|
|
|
|
Message Removed
modified 12-Feb-18 10:02am.
|
|
|
|