Hello, I would like you to help me. I was developing a window authentication with the asp.net language. The question is that it works and when I enter the page, I get the name of the user that is logged in.
The problem is that when I upload my page to an IIS, the name of the logged in user does not appear, but from IIS I would like you to help me.
Since when I run from my Source Code it works for me but when I upload it to IIS I don't get the username of window logged in I get
DefaultAppPol
Someone who can help me please. I've tried everything but I can't get out
If it is possible or not so that they can help me.
Only problem is when I go up to IIS
HTMLLOGIN.
<%
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString();
//txtIp.Text = (clientIPAddress);
txtUsuario.Text = System.Environment.UserName;
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title>.:: Sistema de Usuarios | FINANCIERA QAPAQ S.A. ::.</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet" href="css/style4.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<script type="text/javascript">
var usuario = document.getElementById('<%=txtUsuario.ClientID%>');
usuario.readOnly = true;
</script>
<body>
<center>
<form id="form1" runat="server" method="post">
<div class="group">
<asp:TextBox ID="txtUsuario" runat="server" Width="250px" MinLines="1" MaxLength="15" readonly CssClass="form-control" class="highlight" for="inputSuccess3" ></asp:TextBox>
<label></label>
</div>
<asp:Button runat="server" ID="btnLogin" Width="250px" Onclick="btnLogin_Click" CssClass="btn btn-danger" Text="Iniciar Session" />
</form>
</center>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="css/bootstrap.css"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script src='http://code.jquery.com/jquery-2.1.4.min.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script src='http://code.jquery.com/jquery-2.1.4.min.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index4.js"></script>
</body>
</html>
WEBCONFIG.
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DesbloqueoUsuario.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<connectionStrings>
<add name="con" connectionString="server=10.0.101.85\instbdd01; database=Seguridad; user id=SA; password=SA123456789*;" providerName="System.Data.SqlClient"/>
<add name="conn" connectionString="server=10.0.101.85\instbdd01; database=BatCliente; user id=SA; password=SA123456789*;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<applicationSettings>
<DesbloqueoUsuario.Properties.Settings>
<setting name="DesbloqueoUsuario_localhost_WebService" serializeAs="String">
<value>http://localhost:56117/WebService.asmx</value>
</setting>
<setting name="DesbloqueoUsuario_localhost1_WebService2" serializeAs="String">
<value>http://localhost:56116/WebService2.asmx</value>
</setting>
<setting name="DesbloqueoUsuario_localhost9_WebService3" serializeAs="String">
<value>http://localhost:56117/WebService3.asmx</value>
</setting>
</DesbloqueoUsuario.Properties.Settings>
</applicationSettings>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
</configuration>
problem in IIS
WHEN I RUN ON MY PC
For the case you are considering there are several things that can affect the operation. I will list the things you should check:
Considerations within the application
Make sure the web.config has the following settings.
To get the name of the user on the page (within the Web project)
To get the username from another project (eg a data layer referenced by the Web project)
If you are debugging the project with IIS Express
Make sure that the Windows authentication configuration is correct (anonymous authentication must be disabled, otherwise this will be the default mode that the application will take and it will never authenticate with Windows)
If the project is going to be executed in IIS Local
Make sure the "Windows Authentication" feature is installed on the IIS server. This is done from the "Add and Remove Programs" option of the Operating System
Then verify that the Authentication mode is correctly configured in the "Web Application" where you are publishing (anonymous authentication has to be disabled for the same reason as explained above)
In your
conectionString
addIntegrated Security=True;
so that it is as follows:The official documentation says:
Or in your case, use:
You can try to use on the one hand:
Also, you should keep in mind that you need to have windows authentication activated in the corresponding application. Otherwise, it is possible that the user of the apppool itself will take you.