Umbraco Culture different when published - umbraco

Locally Umbraco Thread.CurrentThread.CurrentUICulture.Name returns "en-GB".
When Published it returns "en-US" using the same database.
I've set Umbraco > Settings > Language > Culture Name to English(United Kingdom)
It's hosted on a Azure App Service

A friend helped and I've added the cultures to the web.config.
Both Local and Server are the same now.
<configuration>
<system.web>
<globalization culture="en-GB" uiCulture="en-GB"/>
</system.web>
</configuration>

Try going to your root node of your site, right click it and select Culture and Hostname.
You should see a dropdown being set to inherit. Change this to en-GB and hit save. Then do the same and change it back to inherit.
This sometimes acts up and it doesn't refresh the setting on the node when you have tried applying a different culture.

Related

User.Identity.Name gives IIS server user name instead client user name

In my MVC application I am tried to show domain/user on top right corner, it works well on visual studio with User.Identity.Name / Request.LogonUserIdentity.Name
When I host this on server it shows server_domain/server_username.
I have already put authentication mode = windows and impersonate true. Using ApplicationPoolIdentity and LoadUserProfile = true.
I know I need to put anonymous off and windows identity on. That I have already done. I have also edited my applicationHost.config and have made override allow for the authentication modes. I have removed lock for both in the same file.
My local domain and server domain is different though.
I am not understanding what am I missing/doing wrong. Can someone help me in this please?
You could use HttpContext.User.Identity.Name to get client user name.
also, make sure you have authorization tag in your system.web in web.config as
<authorization>
<allow users="?" />
</authorization>
https://richhewlett.com/2011/02/15/getting-a-users-username-in-asp-net/

MVC website running on localhost

I've built a little time recording website with MVC4, which I'd like to use to record my time.
Previously, coming from a WebForms background, I'd build an app like this and set it up in IIS as an Application off Default Web Site pointing to the folder, so the URL would be http://localhost/Timesheet
I tried that with the MVC project, but I get a 500 Internal Server error. I assume this is because it's a project vs. a website. If the project is "running" in Visual Studio, then it works, but I don't want to have to open Visual Studio every time I want to record some task I worked on.
I tried adding it as a separate site under the "Sites" folder in IIS, but then I'm not sure what the Host name should be - it won't allow localhost/Timesheet for example.
Is this even possible?
Turns out I just needed to wrap the root web.config's system.web section in:
<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>

Does Umbraco allow non-umbraco subdomains

Hi I am installing Umbraco to the root directory of my website. And also I want to install my wordpress blog to a subfolder in the root directory.
However any request to the subfolder is being intercepted by Umbraco and it is showing that document URL cannot be found. Is there a way to make Umbraco ignore certain subdomains?
You can tell Umbraco to ignore certain paths or folders in the web.config.
You need to update the following entry in the appSetting section of the web.config:
umbracoReservedPaths
Add the subfolder you wish Umbraco to ignore in there.
i.e.
<add key="umbracoReservedPaths" value="/umbraco,/install/,/wordpress/" />
There are more details on the Umbraco web.config settings in on our.umbraco.org
it's useful for binding too:
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/http-bind/" />
~/http-bind/
Thanks Tim Saunders
You can also use umbracoReservedUrls to tell umbraco to ignore specific pages:
<add key="umbracoReservedUrls" value="/mypages/regular-page.aspx" />
This can be set up with in IIS by setting up the blog as a separate application with in the umbraco site.
However if you are trying to make a sub-domain there is no reason why this should be in the same site, I would say it is best to create a separate site with in IIS or purchase another hosting account to host the blog separately

How do I allow reflection on a shared IIS host?

In this question a user replied that he was able to override the security settings on a shared host. I'm using the same host, but haven't been able to figure out how to change web.config to allow reflection. Is it a one-liner?
I'm using MVC + Nhibernate in my project, but I can't even get an Mvc "new project" template site to work, I suppose the problem is reflection.
Try adding the following line to your web.config:
<system.web>
<trust Level="Full" />
</system.web>
Note, however, that the section might be locked by machine.config.

User.Identity.Name blank in ASP.Net MVC

Exactly as per the title.
Simply in my HomeController I have:
string Username = User.Identity.Name;
Why is this value always blank?
Is there something special I have to place in the web.config to get this value to come through. I've tried on both the VS dev web server as well as on a windows server 2003 IIS server.
It's got to be something simple, a server setting in IIS or something as the code is so simple and seems to be the correct way to reference this value.
Thx a lot
If you are wanting to use windows authentication it's not enough to just add
...
<system.web>
...
<authentication mode="Windows"/>
...
</system.web>
...
You also want to check the readme file instructions for the MVC project, especially if your running in IIS Express and using Visual Studio 2012.
See below:
Hosting on IIS Express:
Click on your project in the Solution Explorer to select the project.
If the Properties pane is not open, open it (F4).
In the Properties pane for your project:
a) Set "Anonymous Authentication" to "Disabled".
b) Set "Windows Authentication" to
"Enabled".
Hosting on IIS 7 or later:
Open IIS Manager and navigate to your website.
In Features View, double-click Authentication.
On the Authentication page, select Windows authentication. If Windows authentication is not an option, you'll need to make sure
Windows authentication is installed on the server.
To enable Windows authentication on Windows:
a) In Control Panel open "Programs and Features".
b) Select "Turn Windows features on or off".
c) Navigate to Internet Information Services > World Wide Web Services > Security
and make sure the Windows authentication node is checked.
To enable Windows authentication on Windows Server:
a) In Server Manager, select Web Server (IIS) and click Add Role Services.
b) Navigate to Web Server > Security
and make sure the Windows authentication node is checked.
In the Actions pane, click Enable to use Windows authentication.
On the Authentication page, select Anonymous authentication.
In the Actions pane, click Disable to disable anonymous authentication.
Sure is mate. You need to authenticate with the website. That's the name used for authentication.
You are authenticating, right?
It's not a setting, etc.
Click the LOG IN link, if you're using the stock standard ASP.NET MVC template (if my memory serves me right).
UPDATE (as the posted has added more info/comments)
So what you're after is Windows Authentication. A quick google search came up with this post. It's pretty helpful (though a bit old, but still relevant) .. check that out.
Found a better post with MVC code for Windows Authentication. Check that out instead.
Config setting that is important, is...
...
<system.web>
...
<authentication mode="Windows"/>
...
</system.web>
...
If you do not wish to Authorize on every controller or action, you can do a blanket authorization in the web.config file. This should work as long as you are using Windows authentication. If you allow ASP.NET to control the authentication, then you would not need to configure any IIS setting. It should then work well with whatever web server that you are running on. I do not know or assume what u have tried so far I'll try to be complete in my answer. First remark off the forms authentication tag in web.config. All following settings are placed in the system.web configuration section.
<!--
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
-->
Replace with the Windows authentication tag.
<authentication mode="Windows" />
Then add the authorization tag to deny access to anonymous users. If the users are using Internet Explorer and are connecting from an Intranet zone, IE automatically will login the user. But if the user is connecting from the Internet zone, IE will still display a login box though for safety. But these are options that can be set from IE.
<authorization>
<deny users="?" />
</authorization>
Setting authentication mode alone without authorization does not force the user to be authenticated in ASP.NET. If you want to control the security from IIS, I cannot help much with IIS settings but I know basically you can disable Basic Authentication , then enable Integrated Windows Authentication and then disable the Anonymous Login Account which will achieve the same or better results.
I am also working on an MVC project at the moment and I tested the above settings with my project and it works. You would not need the Authorize attribute since we have the authorization tag in the configuration. I hope this can be of help to you and not get another -1.
Have you attached Authorize attribute to ur action or controller?
public class HomeController : Controller {
[Authorize]
public ActionResult Index() {
string userName = User.Identity.Name;
return View();
}
}

Resources