.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Form level authentication on specific folder

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net

Following is my directory structure of my web application which is also configured in IIS as virtual directory

Web Site Root

    |MasterPage (file)

    |Web Config (file)

    |Public Contents (directory)


    |Admin (directory)

               | Login.aspx


               |WebConfig file (need form security here)

How is configure my both web configs to solve my issue. currently i am getting following error

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.

my root web config has default settings and my Admin directory has following settings


More Related Resource Links

setting up form authentication for a specific folder


I have an "Admin" folder in my application that will include pages that I would not like to have anonymous access to.  When a user attempts to load a page that resides in this folder, I would like to redirect them to a login page. Here is what I have in my config so far.


 <authentication mode="Forms">
      <forms loginUrl="~/Admin/Login.aspx" timeout="2880" >
        <credentials passwordFormat="Clear">
          <user name ="isaac" password="****"/>          
What do I need to add to get the functionality I am lookign for. Thanks




Commerce with ASP.NET: Leverage the Authentication and Form Validation Features of ASP.NET to Bolste


If you're planning to build an e-commerce site, you'll be pleased to see that ASP.NET makes it easier than ever. Existing controls can be used and extended to add a great deal more functionality than you might expect. In this article, forms-based authentication is used to verify the identity of users and make certain areas of the site, such as the check-out page, inaccessible to unauthorized users. The power and flexibility of validation controls are demonstrated using the CustomValidator control to connect to a Web Service that verifies addresses. A shopping cart is then implemented in ASP.NET using the DataGrid, and finally, credit card authorization and billing are performed.

Jason Lefebvre and Robert Lair

MSDN Magazine August 2002

Windows authentication login form issue


Hi guys,

I have an application that requires windows authentication to login, the problem is that every time an user logs in under IE and win XP, the username is pre filled with the IP address of the server as instance and the username. I need to replace the server ip with  XXXX instance name instead of doing this manually.

Could anyone pleas help me out with this one?

Thanks in advance,


Form authentication by using 2 different machine



          i want to use form authentication.i have 2 different application.both are at different machine.i want to use common form authentication. suppose i have 2 application called "app1" and "app2".

There is one form called CElaunch.aspx page in app2.and i want to use this page in app1. we cant navigate the this page directly it should be ask to login page when we open directly. login page is from app1.

app2 web.config file

<authentication mode="Forms">
      <forms loginUrl="http://slx75pc/SlxClientSC73/Login.aspx" domain="configengine.com" protection="All" timeout="30"
    name=".SLXAUTH" path="/" defaultUrl="default.aspx" requireSSL="false" slidingExpiration="true"
    cookieless="UseDeviceProfile" enableCrossAppRedirects="true"/>

new Item form assigned to a specific user

hi, i want to create an absence request form with the new item form. and when the user fill in the form he can't choose for whom he will send it for approval the form is automatically set to be send to a specific approver.   thnx

Form authentication and custome provider

hello frndsi am developing security module in asp.neti am using form authentication along with login control and create user control provided by asp.net.Now, as u guys know that form authentication create aspnet_users table in the database which have limited columns.i also want to maintain additional user information such as address, city etc in the database.how can i achive this?shall i use another user table? if yes then how? and how to synchronize it with aspnet_users table?if instead of aspnet_users table, i should use only user table then how to validate user from login control provided by asp.net?Please guide me or provide me with an example, how to implement this.Thanks in advanceRegardsVipul 

HttpWebRequest Form Authentication Not Getting Past Login Page

Hey Guys,I am trying to use HTTPWebRequest to login to a site and then retrieve the page after login. However, it seems as if I can't get past the login. I also investigated with Fiddler and tried mimicking Fiddler almost completely and still no luck.Any idea what I am doing wrong?Thanks,Mohammed    Dim webRequest As HttpWebRequest Dim responseReader As StreamReader Dim responseData As String Dim postData As String = "login=testexpert@yahoo.com&password=testexpert" Dim cookies As CookieContainer = New CookieContainer() Dim requestWriter As StreamWriter Try 'post form data to page strUrl = "https://www.ideeli.com/login" webRequest = HttpWebRequest.Create(strUrl) webRequest.Method = WebRequestMethods.Http.Post webRequest.ContentType = "application/x-www-form-urlencoded" webRequest.CookieContainer = cookies webRequest.ContentLength = postData.Length requestWriter = New StreamWriter(webRequest.GetRequestStream) requestWriter.Write(postData) requestWriter.Close() 'recieve cookie webRequest.GetResponse().Close() 'now we send the cookie webRequest = HttpWebRequest.Create("http://www.ideeli.com") webRequest.CookieContainer = cookies responseReader = New StreamReader(webRequest.GetResponse.GetResponseStream()) responseData = responseReader.ReadToEnd() res

How to submit my form to Sharepoint Library as well as Sharepoint List with specific Fields only.

Hello ,   I have a Infopath form that contain 50 of fields. i want to submit those form into sharepoint library as well as Sharepoint Custom List(Specific Fields). Please suggest best practice to develop such a functionality.   Thank you.

Form based authentication Sharepoint 2007 gets redirected to login page

Hi We have sharepoint 2007 site deployed on Windows server 2008, IIS 7.0.  We extended the web application to enable forms based authentication referring to link http://msdn.microsoft.com/en-us/library/bb975136(office.12).aspx#MOSS2007FBAPart1_Intro, we selected Kerberos instead of NTLM, behavior is like, when user tries to login into the site using OOB login.aspx, user again gets redirected to the login page. We tried to extend the web application again but this time we selected NTLM, but this time farm account (also is application pool identity) is not able login and exhibits same behavior as above, but for other users we are able to login. Has anyone come across this behavior? can anyone please guide me in correct the behavior? Regards, RK  Radhakrishna

how to get ListItems in Specific folder and not in subfolder ?

Hi,  following query gives me the items in subfolder also, but i need items in specific folder only.   not in subfolder.   what needs to be modified?     string folderQuery = " <Contains><FieldRef Name=\"FileRef\" /><Value Type=\"Text\">" + folderName + "</Value></Contains>";                SPQuery query = new SPQuery();                               query.Query = "<Where><And>"+folderQuery+" <Eq><FieldRef Name='FSObjType'/><Value Type='Lookup'>0</Value></Eq><And></Where>";                                                                           query.RowLimit = 500;             &nbs

Form Based Authentication with Custom database

Hi, I have a Sharepoint 2010 web application and I want to implement FBA(Form Based Authentication) for that. I don't want to use any membership providers and role providers. I have a SQL server database where we will maintain users and roles. I want to use this database for validating user credentials and authenticating them. Is this possible in Sharepoint 2010? Please reply ASAP.

Alternative solution to folder level permissions

I have a document library with multiple levels of folders that group sets of documents. Each folder has unique permissions setup. Ran into issue with URL length limitation because of multiple levels. I am looking at an alternative solution using meta data columns and views to categorize data. Everything is fine except I am not sure how to implement security akin to permissions on folder. How would I implement security based on meta data columns ? One soution that I can think of is creating workflows using SPD. Are there any other solutions for this ?

Need to solve Form Authentication Problem

Hi all, I have a web site with login page and other pages. For login page currently i put authentication mode = Form. Problem is, when login 2 diffenent user in same pc and 1 browser with 2 tab, first tab is 1 user and 2nd tab is another user. I used Form Authentication ticket ,so for each users has different tickets. After login the 1st user and create a entry , then 2nd user login and trying to create entry that time 2nd user ticket is reset to 1st user ticket. is it any way to avoid this issue? if anyone knows about this please give me your suggestion and example. Thanks S.Shangar  

how to change the web application Database connection form Windows authentication to SQL Server acco

Hi, I have a web application created and Database connection authentication was given as Windows authentication. how can i change it to a SQL server account in MOSS 2007. Thanks in advance.

SP 2010 Form Based Authentication username begins with "i:0#.w|"

Hello there! For the life of me, i can't figure out why SharePoint keeps putting the phrase "i:0#.w|" infront of everyones username / accounts. Both on mysite and portal sites. A quick bing search revelaed that i am not the only one: http://fangdahai.blogspot.com/2010/06/i0w-is-still-there-in-sharepoint-2010.html. Anyone have a solution to fix this annoying problem? Thanks!

OU level authentication - AD/Ldap

I want to write a process where i need to authenticate an user against a particular OU in Active Directory. If the AD holds 50 OUs I don't want the process to look into all 50 OUs , instead it should look into a particular OU( for eg: OU=dotnet users)  to authenticate the user. This is to improve the performance by avoiding the time for looking into the entire directory. How can I achieve this? Appreciate your help!

Form based Authentication - OpenLdap problem

Hi everyone,   I try to set up FBA with LdapMembership provider.   I have configured web app + STS like this : <add name="LDAPMember" type="Microsoft.Office.Server.Security.LdapMembershipProvider, Microsoft.Office.Server, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" server="server" port="389" useSSL="false" connectionUsername="uid=portal_sharepoint,ou=people,dc=corp,dc=contoso,dc=com" connectionPassward="somthing" userDNAttribute="distinguishedName" userNameAttribute="cn" userContainer="ou=people,dc=corp,dc=carrefour,dc=com" userObjectClass="person" userFilter="((eduPersonOrgUnitDN=cn=portal_sharepoint,ou=applications,ou=organizations,dc=corp,dc=contoso,dc=com))" scope="Subtree" otherRequiredUserAttributes="sn,givenname,cn" />   I can without problem use the people picker and get user information from it. But when i try to authenticate user i have an error that say : An exception occurred when trying to issue security token: The security token username and password could not be validated.   If i look my log on the ldap i see that all the time it's the portal dn that is used to authenticate user.   I
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend