sayth
sayth

Reputation: 7048

VB.Net 2010 Forms Based Authentication Errors

I am following the codeguru tutorial codeguru tutorial yes its in c# but I cannot find a good VB example.

Initially I am having trouble with the web config file. The tutorial states to do this

<authentication mode="Forms">
<forms name="yourAuthCookie" loginUrl="login.aspx"
protection="All" path="/" />

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

<location path="test.aspx">

<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>

</location>

Now that fails because XML can not have multiple root level documents and if I insert location into the system.web block it errors with system.web has invalid child element location.

I have referred to msdn MSDN ASP.NET authentication however its examples are incorrect or maybe outdated as it example has a 'forms' error as it is not an allowed attribute.

<system.web>
    <authentication mode="Forms">
        <forms forms="401kApp" loginUrl="/login.aspx" />
    </authentication>
</system.web>

Can anyone clarify how this works? I cannot find an accurate walk-through or example for this, if you have located an accurate VB.NET guide if you could show me one that would be very helpful.

As an aside I also found this codeproject example tutorial again in c# but it had enumerate errors from the start with just creating the login pages so can't use this either.

Upvotes: 0

Views: 343

Answers (1)

SLaks
SLaks

Reputation: 887857

The <location> element needs to go directly inside the root <configuration> element.

Upvotes: 2

Related Questions