Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Помогите разобратьса,вроде должно работать а нехочет и ругаетса. Зарание спасибо!!! Вот код: V aspx.cs: private void Page_Load(object sender, System.EventArgs e) { dbconnectUser = new SqlConnection("workstation id=HOME-630FDA66BC;packet size=4096;integrated security=SSPI;data source=HOME-630FDA66BC;persist security info=False;initial catalog=SourceCodeP2P"); } private void btnSubmit_Click(object sender, System.EventArgs e) {// Authenticate username/password from if(CheckPassword(txtUserName.Text,txtPassword.Text)) // If found, display the application's Start page. FormsAuthentication.RedirectFromLoginPage(txtUserName.Text,true); else { // Otherwise, clear the password. txtPassword.Text = ""; // Display message. spnNote.InnerText = "User name or password not found.Please, Try again."; // If third try, display "Access Denied" page. if (System.Convert.ToInt32(ViewState["Tries"]) > 1) Response.Redirect("Denied.htm"); else { // Otherwise, increment number of tries. ViewState["Tries"] = System.Convert.ToInt32(ViewState["Tries"]) + 1; if (System.Convert.ToInt32(ViewState["Tries"]) > 3) Response.Redirect("Denied.htm"); } } } private void btnClier_Click(object sender, System.EventArgs e) { this.txtPassword.Text = ""; this.txtUserName.Text = ""; } private void btnNewUser_Click(object sender, System.EventArgs e) { if (AddUser(txtUserName.Text, txtPassword.Text)) spnNote.InnerText = "User added."; else spnNote.InnerText = "User exists. Choose a different user name."; } private bool AddUser(string userName, string password) { // Declare variable to track success/failure. bool bSuccess = false; // Encrypt the password. password = FormsAuthentication.HashPasswordForStoringInConfigFile(password,"SHA1"); // Create command to insert user name and password. SqlCommand sqlCommand = new SqlCommand("INSERT INTO Users" + " VALUES('" + userName + "', '" + password + "')", dbconnectUser); // Catch errors in case record already exists. try { // Open the database connection. dbconnectUser.Open(); // If record added, set success to true. if (sqlCommand.ExecuteNonQuery()!= 0) { bSuccess = true; // Close connection. dbconnectUser.Close(); } } catch { // Otherwise, success if false. bSuccess = false; // Close connection. dbconnectUser.Close(); } // Return success/failure. return bSuccess; } private bool CheckPassword(string userName, string password) { // Declare variable to track success/failure. bool bSuccess = false; // Encrypt the password. password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1"); // Create command to get row from users table based on UserName. SqlCommand sqlCommand = new SqlCommand("SELECT * FROM Users" + " WHERE userName='" + txtUserName.Text + "'", dbconnectUser); // Check for errors using database try { // Open the database connection. dbconnectUser.Open(); // Get the author ID. SqlDataReader drUsers = sqlCommand.ExecuteReader(); while (drUsers.Read()) { if (password == drUsers["password"].ToString()) bSuccess = true; } // Close connection. dbconnectUser.Close(); } catch { // Otherwise set failure. bSuccess = false; // Close connection. dbconnectUser.Close(); } return bSuccess; } } } V Web.config: <authentication mode="Forms" > <!--<forms registrUrl="registration.aspx" > <!-- Specify a log on form --> <credentials passwordFormat="SHA1"> <!-- Create a user list --> <user name="Admin" password="Admin"/> </credentials </forms> --> </authentication> Pomogite plizzzzzzzzzzzzz ochen nujno!!!!!!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 14:42 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Sharki<authentication mode="Forms" > <!--<forms registrUrl="registration.aspx" > <!-- Specify a log on form --> <credentials passwordFormat="SHA1"> <!-- Create a user list --> <user name="Admin" password="Admin"/> </credentials </forms> --> </authentication> а как ругается? хотя подозреваю ошибка в квоте, либо укажи passwordFormat="Clear" либо замени password на действительно SHA1 последовательность ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 14:59 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Pishet chto <forms Registr....--Unrecognized attribute, a kak doljno bit ya neznayu,ya novichok ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 15:09 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
понятно, замени registrUrl на loginUrl для начала msdn<forms name="name" loginUrl="url" protection="All|None|Encryption|Validation" timeout="30" path="/" requireSSL="true|false" slidingExpiration="true|false"> <credentials passwordFormat="format"/> </forms> остальное в msdn на сайте микрософта с уважением... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 15:26 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Sharki<authentication mode="Forms" > <!--<forms registrUrl="registration.aspx" > <!-- Specify a log on form --> <credentials passwordFormat="SHA1"> <!-- Create a user list --> <user name="Admin" password="Admin"/> </credentials </forms> --> </authentication>красным выделены подозрительные элементы Admin в SHA1 будет 4E7AFEBCFBAE000B22C7C85E5560F89A2A0280B4 Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. остальное не смотерел, может еще что есть зы. прикладываю утилиту для генерации паролей ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 15:29 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Ogromnoe spasibo.Vse forma zarabotala,teper kod nexochet rabotat,mojet i v etom pomojesh.Zaranie spasibo!!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 15:30 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
> teper kod nexochet rabotat так ошибка-то какая?! Posted via ActualForum NNTP Server 1.3 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 15:34 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Oshibku ne kakuyu ne pokazivaet.No v forme kogda vnoshu userName i Password pishet chto...koroche pishet chto username ili password ne nayden a u menya sovsem DB pustaya.Znachit gdeto est problemma.Mojet pomojesh nayti,Zaranie bolshoe spasibo!!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 15:54 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
что у тебя сейчас в этом куске кода? Код: plaintext 1. с уважением... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 17:08 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
<authentication mode="Windows" > <forms loginUrl="registration.aspx" protection="All" timeout="30" path="/"> requireSSL="true|false"> <credentials passwordFormat="SHA1"> <user name="Admin" password="Admin"/> </credentials> </forms> <passport redirectUrl="internal"/> </authentication> с уважением... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.12.2005, 17:49 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
вот здесь Код: plaintext с уважением... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.12.2005, 11:30 |
|
||
|
Помогите разобратьса
|
|||
|---|---|---|---|
|
#18+
Sharki<authentication mode="Windows" > <forms loginUrl="registration.aspx" protection="All" timeout="30" path="/"> requireSSL="true|false"> <credentials passwordFormat="SHA1"> <user name="Admin" password="Admin"/> </credentials> </forms> <passport redirectUrl="internal"/> </authentication> с уважением...вообще-то написан бред RTFM начать можно с http://rsdn.ru/article/inet/aspnet1.xml Posted via ActualForum NNTP Server 1.3 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.12.2005, 12:47 |
|
||
|
|

start [/forum/topic.php?fid=18&msg=33415442&tid=1393258]: |
0ms |
get settings: |
5ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
26ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
36ms |
get tp. blocked users: |
2ms |
| others: | 229ms |
| total: | 320ms |

| 0 / 0 |
