Landing page

Topics: General
Aug 28, 2012 at 10:59 PM

Considering that you can't actually do anything until you login, is there any reason not to have BugNet start with a login page instead of having to click login to get there?

Aug 29, 2012 at 2:18 PM

I guess it depends on how you have it configured. If you have public projects, then users would see those right away on the landing page and don't have to login to browse them.

if you only have private projects then yes, you can't do anything until you log in but throwing the user to a login page first thing may seem a little harsh and doesn't really follow how most websites are built.

Aug 31, 2012 at 11:03 PM

It was a simple 3 line change to Default.aspx.cs, so I did it to my copy.  Also did some minor clean up while I was in there (Default is still pretty 1.1ish).

I'll just have to remember to integrate it when I update to the next version.

Mar 9, 2013 at 5:15 PM
@garumble - Would you mind pointing me at what lines of Default.aspx.cs you modified. I want to do this exact same thing. I've tried using URL Rewrite but that is not working well at all. Would be very grateful if you would share how you did this in the Default.aspx.cs file.

Thanks in advance,
Brad
Mar 10, 2013 at 11:55 PM
If you are using IIS7, 7.5 or 8 you can just change the default document settings in the web.config file.

Just find the <system.webServer> section and add the following (or replace the defaultDocument section with this). This will only work if the user comes to the website without a page path in the url (i.e. Default.aspx)
<defaultDocument enabled="true">
    <files>
        <clear />
        <add value="Account/Login.aspx" />
    </files>
</defaultDocument>
Mar 11, 2013 at 7:07 PM
I added the following code:
            if (ConfigurationManager.AppSettings["StartLoginPage"] != null && Convert.ToBoolean(ConfigurationManager.AppSettings["StartLoginPage"]))
                if (!Context.User.Identity.IsAuthenticated)
                    Response.Redirect("~/Account/Login.aspx");
inside the if (!Page.IsPostBack) conditional block.

The first line isn't required, I only added it so that the option was configurable with a setting in the config file.