Wrox Programmer Forums
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2008, 10:31 PM
Registered User
 
Join Date: Oct 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Restrict user access to database

Hi all. I want only the admin can edit, update and delete the records in database. User can only view the information. Then unauthorized users are not allowed to view the information.
For your information, i stored my database in C:\ drive. Then i stored my project in C:\Inetpub\wwwroot\Project. Previously, i had used the Web Site Administration Tools to set the rules for user, which i deny user access the App_Data and App_Code folder. But when i run the website and test it, user still can edit, update and delete the records. How do i set the rules for the admin and user role? Please advice.. Now, i use these coding to hide the control buttons.

'Determine whether admin or user is visiting the page?
Dim userName As String = User.Identity.Name
If String.Compare(userName, "admin", True) = 0 Then
  'this is admin, show the functionality button
  btnAdd.Visible = True
  btnDeleteSelected.Visible = True
  btnReset.Visible = True
  GridView1.Columns(0).Visible = True
  GridView1.Columns(1).Visible = True
ElseIf String.Compare(userName, "user", True) = 0 Then
  'this is user, hide the functionality button
  btnAdd.Visible = False
  btnDeleteSelected.Visible = False
  btnReset.Visible = False
  GridView1.Columns(0).Visible = False
  GridView1.Columns(1).Visible = False
Else
  'this is unauthorized user, hide the functionality button and
    information
  btnAdd.Visible = False
  btnDeleteSelected.Visible = False
  btnReset.Visible = False
  GridView1.Visible = False
End If






Similar Threads
Thread Thread Starter Forum Replies Last Post
Restrict the user not to direct download rylemer Classic ASP Basics 8 December 15th, 2010 02:25 AM
How I can restrict desktop user to access some res anjanmaity General .NET 1 June 27th, 2008 01:40 PM
Forms: Restrict user selection - How? cdplayer Classic ASP Basics 2 February 29th, 2004 03:37 AM
Login user & restrict access lucian Dreamweaver (all versions) 5 September 7th, 2003 12:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.