I used the Login control in my ASP.NET form.A database was created- ASPNETDB.
But once I create a user and then execute the form next time,I cant login, i.e., I've to register as a new user everytime I simulate the web form. The code cant retrieve my previously stored login id and password.How can I fix it?
The problem could be that the database file is been copied to the output directory everytime you run your application and overriding the previous copied file that contains the registration data.
If that was the problem, you can solve it by change the database file's Copy To Output Directory property value from always copy to copy if newer.
Solution #1: Under the "project" tab in Visual Studio, go to ASP.NET configuration. Make sure that the "active" check box is checked, under security, manage users (ASP.NET default login tables).
Solution #2: Use your login tables.
Solution #3: Still searching for it.
Related
I am a total newbie.
I create a website with 2 pages
Update data (update.aspx)
Add data to database (add.aspx)
I want to create login page before they can access this pages.
Even if they tried accessing by typing direct url like : www.example.com/add.aspx
they should not be allowed
And secondly,
I want to generate txt log files when they click update or add button
example
User: abc updated current field in databse on (time and date)
I hope you guys help me out. :)
am using visual studio 2012 and SQL Server
As I understand of your question, you want to activate authentication in your project. In this way there is a great article about Authentication in ASP.NET that is suitable for newbies.
ASP.NET authentication and authorization
The "Forms Authentication" section in the article can fulfill you expectation.
Also, there are some logging libraries like NLog, Log4Net, Logging Application Block that are advanced and have lots of facilities, but for starting I recommend you reading Create Simple Error Log Files using ASP.NET and C#. With a bit change in the code you can log the text that you've mentioned.
I Want Set Access level user For Buttons in the forms. example in the each form i have Add , Edit ,search and Delete button and I want user1 access to delete and update button in the form 1 and user 2 access to all buttons in each forms.
i create Table for Save Forms Name and Create other Table for Save User Profile and create table for save access User to forms and button. But I do not know how these settings in the form.
In any form is when you load the data read from the database?And to apply settings or Can I do this, write a general function,That automatically does this for every form????
thanks all
The following link was of great help when I encountered the same problem (it is for asp.net 2.0 but applies to the newer versions):
Recipe: Implementing Role-Based Security with ASP.NET 2.0 using Windows Authentication and SQL Server
SO in few words, you need to set up the Roles and then use them to enable access to users according to their roles. Enabling buttons and disabling buttons in a form can happen in the code behind utilizing the Roles.
For example you can use this piece of code if you have setup a role called Administrators:
If User.IsInRole("Administrators") Then
'Do something only admins are allowed to-do
End If
I hope that this is helpfull.
I am new to .NET framework and I want to create a profile page for each user to edit their own page. How do I make this edit page only available to the specific user? Is there a way to do this without me manually going into the code every time I have a new user sign up?
I'd take a look at ASP .NET Membership. Then you can lookup the user "profile" based on their Id to load the appropriate information.
You start by ensuring that the page is only visible to authenticated users. You do this by setting the appropriate settings in web.config for the corresponding folder or file.
Once you've done that, this page should simply load details for the current user. All users would see the same page, but it's content would be populated by your code only for this current user.
There would therefore be no way for one user to display the contents for another user. The ID of the user being viewed/edited should definitely not be a query argument or anything like that.
I have the following scenario: a Silverlight application (constructed to be OOB) embedded at an ASP.NET website where, if the user already installed it, a label saying that is displayed; otherwise, an install button appears. Eventually I can update the .xap file available in the website.
Now the problem: if the user executes the application through his Desktop/Start Menu, i'm able to update the application and suggest the user to restart it. But, if I update the .xap file and upload it again to the website, apparently no "Silverlight update" occurs, it is displayed as a new application (if the user install it again, an application icon is displayed at his desktop).
Is there something I'm missing or there's nothing to do about this?
Thanks!
Signing the Silverlight application solves the problem.
When you run in a browser, updates are picked up right away (subject to HTTP caching rules). With OOB apps you need to use the App.Current.CheckAndDownloadUpdateAsync() method in your app to have it update.
http://msdn.microsoft.com/en-us/library/system.windows.application.checkanddownloadupdateasync(v=vs.95).aspx
The only drawback is that there is no way to just check for an update and give the users an option to download it conditionally; calling this always updates it if there is an update. You can however hook into the event and find info about the update should you wish. See this resource for more information: http://forums.silverlight.net/forums/p/180931/408554.aspx
I have a set of four ASP.NET roles that I have been trying to delete - they never want to die.
Simply put, I've deleted them successfully by using the website administrator tool and by running the stored procedure:
exec aspnet_Roles_deleteRole '/', 'CameraOwner', 1;
My application name is '/'. I see the records getting deleted from the database. No one is using it. I refresh my role management page - it is gone. However, the next time my application restarts - and sometimes after a page refresh, the deleted roles get re-inserted.
Added: If I delete the roles and do an iisreset: the roles are still deleted. As soon as I hit my application (even with a wget that doesn't have any pre-existing cookies) the roles get re-inserted.
Has anyone experienced this before?
UPDATE: Found my problem. Yet Another Forum.NET had linked Roles. Everytime you reloaded the application, it recreated the missing linked roles.
How did the roles get into your system in the first place? Do you have any code that automatically adds roles? Can you try changing the DB name to make sure another system isn't hitting the same database?