Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello! All,
I have an admin section folder for my website where I can do some changes in the admin section and the same would reflect on my website, what I want to do is I want to open my admin site in the following manner.

1) http://localhost:9180/testsite/admin/login.aspx for my admin section
It is inside the website under admin folder.

and the main site should open as
2) http://localhost:9180/testsite/Index.aspx.
I'm confused about how to achieve this?
Posted
Updated 17-Jul-14 20:08pm
v2
Comments
Sergey Alexandrovich Kryukov 18-Jul-14 2:13am    
Confuse with what? How it's different from just having a Web site with more than one pages? :-)
Did you implement authentication?
—SA
Nischal Bhatt 18-Jul-14 2:17am    
Hey! Sergey,
What I want is it should open separately and what config changes it'll be needing to open the application separately, i.e. Admin section should open differently and Main site should open separately, Yes I've implemented authentication.

Well Nischal,
since you have already structured it proper but a little fine tuning is needed.
Rename login.aspx -> default.aspx
Create on master page under admin folder and link all other pages which you wish to make available to admin from that master page.
once user logs in, maintain session with role, user id and clear it when logs out.
on page load event of master page, checks for session values and when it is clear / null then redirect to default.aspx

these are few steps, if you do it then it would be easier to separate admin pages. Same steps can be applied other user login / folders also.

happy programming
anurag
 
Share this answer
 
Comments
Thanks7872 18-Jul-14 2:25am    
Why to rename login.aspx to default.aspx?
AnuragTripathi 18-Jul-14 2:28am    
Because it is default property of iis to load default.aspx, if you wish to load it on browser address like http://www.testcode.com/admin then you need to rename it. Otherwise you can use as it is.
simpple!!

add below in root web config file

XML
<location path="Admin">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900