Last post Mar 07, 2018 09:36 PM by KathyW
Mar 05, 2018 07:18 PM|SaeedP|LINK
I've defined user name and password for admin in web.cofig :
<forms name="SavingsPlan" defaultUrl="admin.aspx" loginUrl="Login.aspx" >
<system.web> <authorization> <allow roles="Administrator"/> <deny users="*"/> </authorization> </system.web> </location>
and place a login control on the my admin page:
public partial class login : System.Web.UI.Page
protected bool authenthicate(String name,String password)
if(name == "admin")
if (password == "7712757")
public void onLogin(String name,String password)
Response.Write("Invalid user name or password");
but it isn't working.
Can you please inform me where is wrong in my code?
Mar 06, 2018 03:25 AM|Eric Du|LINK
According to your description, you say not working, if you meet some error message or exception message?
About how to implement it, here are someone who meet the similar issue as you, please check:
ASP.NET - Login Control with Credentials in web.config file:
how to set login control to compare the credentials stored in web.config?
Mar 06, 2018 09:36 PM|SaeedP|LINK
I see no error. But the code nothing happens. The web.config code works.
My problem is login control.
Mar 07, 2018 12:41 AM|KathyW|LINK
Your password is not SHA1, it's plain text. Replace "SHA1" with "Clear".
After that, what do you mean "nothing happens"? What do you do, what to you expect to happen, and what happens?
Mar 07, 2018 09:20 AM|Eric Du|LINK
According to your description, you say you have problem in the login control, could you tell us the detailed error message?
Mar 07, 2018 02:35 PM|SaeedP|LINK
It errors this code:
Mar 07, 2018 09:36 PM|KathyW|LINK
And what is the error?
https://msdn.microsoft.com/en-us/library/ka5ffkce%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 would say you need parameters in that call, not just ().