[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

login control, VB.Net 2.0, subfolder

Posted on 2006-04-28
5
Medium Priority
?
2,696 Views
Last Modified: 2008-01-09
Hi,

Using VB.Net 2.0:
I want to protect a subfolder in a website. When I put the login page inside the subfolder and debug, I get an error saying the file is missing because it's looking for the file in the root of the site, not the subfolder. I moved the login file into the root folder. So now I can see what happens when I debug.

Once I publish the site I get an error because the login page isn't in the subfolder.

Anyone else seen this and solved it? Anyone have any ideas? Seen any tutorials anywhere to protect a subfolder?

Thanks,
MH
0
Comment
Question by:MHenry
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
daniel_balla earned 2000 total points
ID: 16564198
Hi MHenry,
the location of the login page is set in web config, under the authentication node, such as:
<authentication mode="Forms">
        <forms name="SqlAuthCookie" loginUrl="Login.aspx"  timeout="10" />
      </authentication>

here you can set it anywhere you want.

In order to grant access to certain roles only on some folders, all you have to do is under that folder create another web.config file ad set it to something like:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <system.web>
<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>
    </system.web>
</configuration>

This would only allow authorized users in this folder.
Or set it to something like:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <system.web>
     
        <authorization>
            <deny users="?" />
            <deny users="*" />
            <allow roles="Admin" />
        </authorization>
    </system.web>
</configuration>

This would only grant access to users within role Admin to this folder. Hope this helps.

Cheers!
0
 
LVL 9

Expert Comment

by:daniel_balla
ID: 16564242
0
 
LVL 7

Author Comment

by:MHenry
ID: 16564401
daniel_balla,

Yes, I used that tutorial to get a start on this. Unfortunately, it doesn't address subfolders and how to configure for those.

Thanks,

MH
0
 
LVL 9

Expert Comment

by:daniel_balla
ID: 16565296
But it does, read my previous post. You just create another web.config file under your subfolder, and set the access rights in it for that subfolder
0
 
LVL 7

Author Comment

by:MHenry
ID: 16565915
Daniel,

Sorry, don't know how I missed the first post but when I viewed the page, I only saw the one about the video.

Your suggestion:
<authentication mode="Forms">
        <forms name="SqlAuthCookie" loginUrl="Login.aspx"  timeout="10" />
      </authentication>

worked perfectly.

Thanks!

MH

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question