AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 problem in page authentication and authorization
Posted by premiya on  4/13/2010 7:56:22 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
i am a beginner in asp .net

I have 15 pages totally including login.aspx & masterpage.

I have three roles Manager, Admin, User

the user who have password and username have acess


Manager ( Manager.aspx)

user (user.aspx)

admin(all the pages)

all should having same login page.


the who does not having authorization should be redirected to login.aspx

how to do it?

i host my site today.

when i gave url like www.fff.com/user.aspx it directly redirects to that page without getting any password and username but actually it have to redirect to the login .aspx

without getting username and password it wont allow to acess otherpages
how to do it


please help me.i have to complete that task on tommorrow!

Thank in Advance

My web.config file it produced the error





<system.web>

<authentication mode="Forms">

<forms loginUrl="default.aspx" defaultUrl="default.aspx" name="ASPNETAUTH" path="/" timeout="20" ></forms>

</authentication>
<authorization>
<deny users="?"/>

<allow users="*"/>


</authorization>


<customErrors mode="Off" defaultRedirect="index.htm">

</customErrors>

</system.web>

that is the error i got after hosting my site




Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 46:
Line 47:
Line 48: <authentication mode="Forms">
Line 49:
Line 50: <forms loginUrl="default.aspx" defaultUrl="default.aspx" name="ASPNETAUTH" path="/" timeout="20" ></forms>


Post Your Reply Post New Question

 Viewer's Reply
using FormsAuthentication in Asp.Net
Answered By Moderator1 on 6/2/2010 11:34:05 PM
Hi,

To try Forms Authentication for initial stage you need to make it simple configuration as below,

<authentication mode="Forms" >
<forms loginUrl="~/Login.aspx" defaultUrl="~/default.aspx" protection="None" timeout="20"></forms>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>

In your code, you have mentioned loginUrl as 'default.aspx', but you have mentioned that you need to go login.aspx.
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Simply SQL - Free 111 Page Preview!
The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition - Free 207 Page Preview!
Oracle Magazine