{"id":2548,"date":"2025-04-18T21:53:16","date_gmt":"2025-04-18T18:53:16","guid":{"rendered":"https:\/\/www.aydiner.gen.tr\/?p=2548"},"modified":"2025-04-18T22:00:16","modified_gmt":"2025-04-18T19:00:16","slug":"asp-net-giris-islemleri-hosgeldin-yazisi","status":"publish","type":"post","link":"https:\/\/www.aydiner.gen.tr\/index.php\/2025\/04\/18\/asp-net-giris-islemleri-hosgeldin-yazisi\/","title":{"rendered":"Asp.net Giri\u015f \u0130\u015flemleri Ho\u015fgeldin yaz\u0131s\u0131"},"content":{"rendered":"<p>master sayfas\u0131&#8212;-<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\r\n protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            if (Session&#x5B;&quot;KullaniciAdi&quot;] != null)\r\n            {\r\n              LblKullanici.Text = &quot;Ho\u015f geldin, &quot; + Session&#x5B;&quot;KullaniciAdi&quot;].ToString();\r\n               BtnCikis.Visible = true;\r\n               BtnGiris.Visible = false;\r\n            }\r\n            else\r\n            {\r\n               LblKullanici.Text = &quot;&quot;;\r\n               BtnCikis.Visible = false;\r\n                BtnGiris.Visible = true;\r\n\r\n            }\r\n        }\r\n\r\n        protected void Button1_Click(object sender, EventArgs e)\r\n        {\r\n            Response.Redirect(&quot;giris.aspx&quot;);\r\n        }\r\n\r\n        protected void BtnCikis_Click(object sender, EventArgs e)\r\n        {\r\n            Session.Abandon();\r\n            Response.Redirect(&quot;giris.aspx&quot;);\r\n        }\r\n\r\n<\/pre>\n<p>giri\u015f yap sayfas\u0131&#8212;<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n        protected void Button1_Click(object sender, EventArgs e)\r\n        {\r\n            string email = TextBox1.Text.Trim();\r\n            string sifre = TextBox2.Text.Trim();\r\n\r\n            \/\/ Veritaban\u0131 ba\u011flant\u0131 c\u00fcmlesi (Kendi SQL ba\u011flant\u0131n\u0131 yaz)\r\n            string connectionString = &quot;Data Source=DESKTOP-3S3IQ27\\\\SQLEXPRESS;Initial Catalog=uye;Integrated Security=True&quot;;\r\n\r\n            using (SqlConnection con = new SqlConnection(connectionString))\r\n            {\r\n              string query = &quot;SELECT AdSoyad, Rol FROM uye WHERE Eposta = @Eposta AND Sifre = @Sifre&quot;;\r\n\r\n                SqlCommand cmd = new SqlCommand(query, con);\r\n                cmd.Parameters.AddWithValue(&quot;@Eposta&quot;, email);\r\n                cmd.Parameters.AddWithValue(&quot;@Sifre&quot;, sifre);\r\n\r\n                con.Open();\r\n                SqlDataReader reader = cmd.ExecuteReader();\r\n\r\n                if (reader.Read()) \/\/ Kullan\u0131c\u0131 bulundu mu?\r\n                {\r\n                    \/\/ Do\u011fru bilgileri alal\u0131m\r\n                    string kullaniciAdi = reader&#x5B;&quot;AdSoyad&quot;].ToString();\r\n                    string rol = reader&#x5B;&quot;Rol&quot;].ToString();\r\n\r\n                    \/\/ Session&#039;a do\u011fru bilgileri kaydedelim\r\n                    Session&#x5B;&quot;KullaniciAdi&quot;] = kullaniciAdi;\r\n                    Session&#x5B;&quot;Rol&quot;] = rol;\r\n\r\n                    reader.Close(); \/\/ Reader&#039;\u0131 kapatal\u0131m\r\n\r\n                    \/\/ Y\u00f6nlendirme yap\r\n                    if (rol == &quot;Admin&quot;)\r\n                    {\r\n                        Response.Redirect(&quot;Yonetim.aspx&quot;); \/\/ Admin y\u00f6netim sayfas\u0131na gider\r\n                    }\r\n                    else\r\n                    {\r\n                        string script = &quot;Swal.fire({title: &#039;Ba\u015far\u0131l\u0131!&#039;, text: &#039;Ho\u015f geldin, &quot; + kullaniciAdi + &quot;!&#039;, icon: &#039;success&#039;}).then((value) =&gt; { window.location=&#039;Default.aspx&#039;; });&quot;;\r\n                        ScriptManager.RegisterStartupScript(this, GetType(), &quot;sweetalert&quot;, script, true);\r\n\r\n\r\n                        Response.Redirect(&quot;Default.aspx&quot;); \/\/ Normal kullan\u0131c\u0131 anasayfaya gider\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    Label1.Text = &quot;Kullan\u0131c\u0131 ad\u0131 veya \u015fifre yanl\u0131\u015f!&quot;;\r\n                }\r\n\r\n                reader.Close();\r\n            }\r\n        }\r\n<\/pre>\n<p>yonetim sayfas\u0131 &#8212;<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            if (Session&#x5B;&quot;Rol&quot;] == null || string.IsNullOrEmpty(Session&#x5B;&quot;Rol&quot;].ToString()) || Session&#x5B;&quot;Rol&quot;].ToString() != &quot;Admin&quot;)\r\n            {\r\n                string message = &quot;Yetkili Ki\u015fi De\u011filsiniz!&quot;;\r\n                ScriptManager.RegisterStartupScript(this, GetType(), &quot;showalert&quot;, &quot;alert(&#039;&quot; + message + &quot;&#039;);&quot;, true);\r\n                Response.Redirect(&quot;giris.aspx&quot;);\r\n            }\r\n\r\n            if (Session&#x5B;&quot;KullaniciAdi&quot;] != null)\r\n            {\r\n                lblHosgeldin.Text = &quot;Ho\u015fgeldin, &quot; + Session&#x5B;&quot;KullaniciAdi&quot;].ToString();\r\n               \r\n            }\r\n\r\n        }\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>master sayfas\u0131&#8212;- protected void Page_Load(object sender, EventArgs e) { if (Session&#x5B;&quot;KullaniciAdi&quot;] != null) { LblKullanici.Text = &quot;Ho\u015f geldin, &quot; + [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":547,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[243],"class_list":["post-2548","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web","tag-asp-net-kullanici-girisi"],"_links":{"self":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts\/2548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/comments?post=2548"}],"version-history":[{"count":4,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts\/2548\/revisions"}],"predecessor-version":[{"id":2552,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts\/2548\/revisions\/2552"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/media\/547"}],"wp:attachment":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/media?parent=2548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/categories?post=2548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/tags?post=2548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}