0

I have a log in page which is the home page so is located at www.domainname.com

when someone goes to this page it adds a returnurl to the string so they are at:

www.domainname.com/default.aspx?ReturnUrl=%2f so when they log in they get returned to http://www.domainname.com/, which is the login page again, so to access the site they have to login twice.

Does anyone know how to fix this? I think a fix to this would be to allow everyone access to the home page - http://www.domainname.com/ as well as http://www.domainname.com/default.aspx but i'm not sure how to acheive this.

I want all user roles to be denied access to every page apart from the home page before they login, i also have an admin/cms section that only Admin roles can access but everyone can access the cms login page.

I currently have this in my web.config

        <authentication mode="Forms">
        <forms protection="All" loginUrl="default.aspx" defaultUrl="~/home/" />
    </authentication>
    <authorization>
        <allow roles="Admin, User"/>
        <deny users="?" />
    </authorization>

    <location path="default.aspx">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</location>

<location path="cms/default.aspx">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
</location>

<location path="cms">
    <system.web>
        <authorization>
            <allow roles="Admin"/>
            <deny users="*"/>
        </authorization>
    </system.web>
</location>

3 Answers 3

3

Well i seemed to have done it a bit by luck.

I just changed

<authentication mode="Forms">
    <forms protection="All" loginUrl="default.aspx" defaultUrl="~/home/" />
</authentication>

To

<authentication mode="Forms">
    <forms protection="All" loginUrl="/" defaultUrl="~/home/" />
</authentication>
Sign up to request clarification or add additional context in comments.

Comments

0

You should send them to the page you want them to default to. What you should do is create the login page on a seperate page (login.aspx) for instance and then make the default.aspx page the home page. Then when they go to default.aspx they will be redirected to login.aspx?ReturnURL=%2f .

1 Comment

Seems a bit strange that you have to have it that way, been designed to have the home page as the login page.
0

Yes, we can use the above solution. One problem here is when we are using SEO implementation. To achieve your requirement, you can use URLRewrite.

http://weblogs.asp.net/scottgu/archive/2010/04/20/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.