Wrox Programmer Forums
|
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 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 February 5th, 2009, 07:21 PM
Friend of Wrox
 
Join Date: Mar 2008
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.
 
Old February 5th, 2009, 09:02 PM
Wrox Author
 
Join Date: Oct 2005
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."
===============================================
 
Old February 5th, 2009, 09:18 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
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(); 
}
 
Old February 5th, 2009, 10:05 PM
Friend of Wrox
 
Join Date: Mar 2008
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.
 
Old February 6th, 2009, 12:00 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
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(); 
}
 
Old February 6th, 2009, 01:13 AM
Friend of Wrox
 
Join Date: Mar 2008
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.
 
Old February 6th, 2009, 01:27 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
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(); 
}
 
Old February 6th, 2009, 01:33 AM
Friend of Wrox
 
Join Date: Mar 2008
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 :)





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 05: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 04:19 PM
Web.Config tranzformerz ASP.NET 1.0 and 1.1 Basics 1 August 29th, 2005 05:59 PM





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