ASPForums.Net RSS Feed additions to the content that appears on ASPForums.Net(c) 2019 All rights reserved.Automatically login in website by passing Username and Password in QueryString in ASP.Net<p>@Pradip</p> <p>My requirement is:</p> <p>If I say that autouser login, this means user has to <strong>include user id and password to url for verification.</strong><br /><strong></strong></p> <p><strong>i.e, if i write this in addressbar:</strong>,Password=1234</p> <p>NOTE: in above url, i am entering the <strong>username</strong> and <strong>password</strong> in address bar to redirect on "xyz.aspx" page</p> <p>How to do this?</p> <p>Please reply.</p>, 02 Feb 2014 08:53:12 GMTAutomatically login in website by passing Username and Password in QueryString in ASP.Net<p>This way</p> <pre class="brush: csharp"> protected string UserName { get { return (Request.QueryString[&#34;UserName&#34;]); } } protected string Password { get { return (Request.QueryString[&#34;Password&#34;]); } } protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (this.UserName !=null) { string userName = this.UserName; string password = this.Password; this.Login(userName, password); } } } private void Login(string name, string password) { string constr = ConfigurationManager.ConnectionStrings[&#34;ConString2&#34;].ConnectionString; string sqlStatment = &#34;SELECT * FROM Users Where UserName = @UserName AND Password = @Password&#34;; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand(sqlStatment, con)) { using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { cmd.Parameters.AddWithValue(&#34;@UserName&#34;, name); cmd.Parameters.AddWithValue(&#34;@Password&#34;, password); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count &gt; 0) { Response.Redirect(&#34;Home.aspx&#34;); } } } } }</pre> <p>Thank you</p>, 02 Feb 2014 09:51:03 GMT