Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 5th, 2009, 06:21 PM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default web config

is it possible to create a permanent user in the web config file? and give him Admin Privillages?

i made one using that asp config thing but i cant log in with that user for some reason. its kind of annoying, if anyone knows if i am missing a step between creating a user with admin privillages with ASP config and logging in with said user account please let me know.
  #2 (permalink)  
Old February 5th, 2009, 08:02 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Could you, yes. Should you? I wouldn't. ASP.NET provides the capability to handle this in the database out of the box. Rather than recite things that have been wrote about extensively on the net I am going to point you to Scott Guthrie's blob that has a wealth of information on Membership, roles, and so forth.

http://weblogs.asp.net/scottgu/archi...esources-.aspx

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
  #3 (permalink)  
Old February 5th, 2009, 08:18 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You can easily define usernames and passwords in web.config file:

Code:
<authentication mode="Forms">
   <forms>
      <credentials passwordFormat="Clear">
         <user name="Iceman" password="IceIsTheMan123!" />               
      </credentials>            
   </forms>         
</authentication>
Unfortunately, there is no way to assign a user to a role in web.config. However, you can always assign a user to a role in code if you need to -- like in a Page_Load method, if you wanted to test something out, for example.

In the long run, it might be better to try to get your regular authentication / authorization working right. Are you not able to log in the user at all? Or is it just not picking up on the role?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #4 (permalink)  
Old February 5th, 2009, 09:05 PM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

it wouldnt let me log in the user at all. i had to register a new user instead.
  #5 (permalink)  
Old February 5th, 2009, 11:00 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

And the new user worked?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #6 (permalink)  
Old February 6th, 2009, 12:13 AM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

it did.

but i wont be able to do much with my site atm... im getting this error when i log in now...

One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
Log file 'C:\MemberSites\MemberSites_AspSpider_Info\iceman9 0289\webroot\App_Data\aspnetdb_log.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.
  #7 (permalink)  
Old February 6th, 2009, 12:27 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Both this error, and the not being able to log in with a previously created user, are related to moving the database.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #8 (permalink)  
Old February 6th, 2009, 12:33 AM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

ah okay. well i got it fixed. i had to refresh the connection.
thanks :)
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
web.config dpkbahuguna ASP.NET 3.5 Basics 2 August 26th, 2008 09:41 AM
web.config vs. app.config darlo Visual Studio 2005 11 August 20th, 2008 07:23 AM
I need Help with web.config please ! _fluffy_ BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 4th, 2007 04:31 PM
Web Config SteveP55419 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 3rd, 2007 03:19 PM
Web.Config tranzformerz ASP.NET 1.0 and 1.1 Basics 1 August 29th, 2005 05:59 PM



All times are GMT -4. The time now is 12:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.