Advertisement
Guest User

Untitled

a guest
May 9th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
  2. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
  3.  
  4. Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation
  5.  
  6. protected void NavigateToProfile_Page(object sender, EventArgs e)
  7.  
  8. {
  9.  
  10. Button myButton = (Button)sender;
  11. String user_name = myButton.Text;
  12. Session["Username"] = user_name;
  13. Response.Write("ProfilePage.aspx");
  14. }
  15.  
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Linq;
  19. using System.Web;
  20. using System.Web.UI;
  21. using System.Web.UI.WebControls;
  22. using System.Data;
  23. using MySql.Data.MySqlClient;
  24.  
  25. public partial class ProfilePage : System.Web.UI.Page
  26. {
  27. protected void Page_Load(object sender, EventArgs e)
  28. {
  29. String username = Convert.ToString(Session["Username"]);
  30.  
  31. MySqlConnection con = new MySqlConnection("Server=localhost;Database=FreedomKitchen;Uid=root;Password=;");
  32. con.Open();
  33. MySqlCommand cmd = new MySqlCommand("Select User_Details(User_ID,First_Name,Last_Name,Age,Gender,Country,About_User from User_Details where Username='" + username + "'", con);
  34. MySqlDataAdapter da = new MySqlDataAdapter();
  35. da.SelectCommand = cmd;
  36. DataSet ds = new DataSet();
  37. da.Fill(ds,"User_Det");
  38. DataRow dr = ds.Tables["User_Det"].Rows[0];
  39. String fname, lname, age, g, about_user;
  40.  
  41. fname = Convert.ToString(dr["First_Name"]);
  42. lname = Convert.ToString(dr["Last_Name"]);
  43. age = Convert.ToString(dr["Age"]);
  44. g = Convert.ToString(dr["Gender"]);
  45. about_user = Convert.ToString(dr["About_User"]);
  46.  
  47. Label1.Text = fname;
  48. Label2.Text = lname;
  49. Label3.Text = age;
  50. Label4.Text = g;
  51. Label5.Text = about_user;
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement