|
Sorry for another thread.
I have the following that is supposed to read from web.config file.
public string ReadConfig(string ValueToGet)
{
System.Configuration.AppSettingsSection section = (System.Configuration.AppSettingsSection)config.GetSection("appSettings");
return section.Settings[ValueToGet].Value;
}
string URL = Master.ReadConfig("DailyReport");
The application runs perfectly on my local machine but again when run from the server, it gives the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Any idea how to fix this?
Thanks again in advance
|
|
|
|
|
Which line of code raised the error? The actual problem is usually not to difficult to resolve once you know which reference is the problem. You may wish to edit your question and show the actual contents of the config file. Are you sure all refernces are correctlym spelled?
|
|
|
|
|
Richard, thanks for your response.
This is the ReadConfig () method:
public string ReadConfig(string ValueToGet)
{
System.Configuration.AppSettingsSection section = (System.Configuration.AppSettingsSection)config.GetSection("appSettings");
return section.Settings[ValueToGet].Value;
}
The first error is on this line:
return section.Settings[ValueToGet].Value;
Then ReadConfig tries to call the report with this:
string URL = Master.ReadConfig("DailyReport");
This is the line that generated the second error.
Then this is the web.config content that Master.ReadConfig("DailyReport"); is trying to call:
<add key="DailyReport" value="http://servername/ReportServer?/Reports/DailyReport"/>
I have had similar issues with ReadConfig() function which I was able to resolve.
For instance, This line was generating exact same error:
appVersion.Text = ReadConfig("AppVersion");
and I was able to resolve it with this:
WebConfigurationManager.AppSettings["AppVersion"]
But the Master.ReadConfig(...) line is a bit too challenging.
|
|
|
|
|
|
It's ok.
I have resolved the problem.
|
|
|
|
|
Greetings experts,
I have been struggling with this now for about two days to no avail.
When a user loads our app on a browser, the app determines user's machine name and determines whether user should have a Read Only access to the app or Read/Write access based on two AD group names.
If the user does not belong to any of those groups, access to the app is denied the user with a message indicating so.
This works perfectly on my local machine.
However, when I deploy the app to our server, it does not record user's access level and is constantly denying user access to the app.
We have determined that the server can communicate with our AD.
I am pretty stumped by this.
Can someone please help with the code below and see if it could be written differently?
Many thanks in advance.
IPAddress hostIPAddress = IPAddress.Parse(Request.UserHostName);
IPHostEntry hostInfo = Dns.GetHostEntry(hostIPAddress);
string[] tempSystemName = hostInfo.HostName.Split('.');
WebLibrary.loadUserInformation(Request.LogonUserIdentity.Name, Request.UserHostAddress, tempSystemName[0]);
currentUser.Text = "Current User: " + WebLibrary.visitorFullName + "<br />Access: " + userType + "";
modified 11-Dec-20 13:12pm.
|
|
|
|
|
Is the user actually authenticating to your application? You need to make sure anonymous authentication is turned off, and Kerberos/Windows authentication is turned on.
Depending on your group policy settings, Internet Explorer, Edge, and Chrome should automatically sign the user in to any site which is part of IE's "local intranet" zone. Firefox will need additional configuration in the about:config page:
network.automatic-ntlm-auth.allow-proxies = Truenetwork.negotiate-auth.allow-proxies = Truenetwork.automatic-ntlm-auth.trusted-uris = comma-separated list of host names which should use integrated authentication
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
Great to hear from you sir.
Hope you are staying safe.
I just turned off Anonymous Authentication and enabled Windows Authentication and now it works.
The only issue (a minor one) is that unlike running on my local machine where the application automatically authenticates my account and allows me in, the application is asking me to sign in using my Windows account.
Once this is done, I am automatically in and it works now.
When this app runs on our production server, users are not explicitly asked to sign in. Their identities are automatically recognized and they are in without having to sing in.
Oh well, this is our test site. I guess we have to deal with having to sign in all the time.
UPDATE: I set .Net Rules in IIS as well to deny anonymous users and now it is no longer challenging for authentication.
Many thanks. You have never failed me. Thank you sir.
modified 11-Dec-20 9:31am.
|
|
|
|
|
|
Sorry sir, I forgot to close this out.
Thank you again for your continued assistance.
|
|
|
|
|
In our web solution we have a WebAPI solution, a WebApplication and a local ADFS server.
ADFS server need be setup with exact URL of web app....
For simplicity sake we decided to use (local) IIS hosting and debugging, as in "<a href="http://localhost/myAPI">http://localhost/myAPI</a> " and "https://localhost/myWebApp "
The problem starts when.. and HTTPS app need a certificate...
So I got to:
IIS Management Studio > Default Web Site > Bindings...
And add the ISS Express Development Certificate.
Unfortunately, it feels like Visual Studio is deleting that setting every second time I press F5 / try to debug. And I continuously have to open IIS Management Console and setup the HTTPS binding again and again and again.
Any idea what's going on and fix that bummer?
|
|
|
|
|
@{
foreach (var item in (List<TarefasModel>)ViewBag.MostrarTarefas)
{
<tr>
<td><button type="button" class="btn btn-warning" data-toggle="modal" data-target="'#Modalpopup + @item.Id'">Editar</button></td>
<td>@item.Id</td>
<td>@item.NomeTarefa</td>
<td>@item.Descricao</td>
<td>@item.Atribuido</td>
<td>@item.DataVencimento</td>
<td><button type="button" class="btn btn-success" onclick="Excluir(@item.Id)">Concluido</button></td>
</tr>
}
}
</tbody>
I need pass the ID in modal . I try this :
<td><button type="button" class="btn btn-warning" data-toggle="modal" data-target="'#Modalpopup + @item.Id'">Editar</button></td>
But this not work
|
|
|
|
|
How about you start with the documentation?
Modal · Bootstrap v4.5 - Varying modal content[^]
If that doesn't help, you're going to need to explain what "not working" means, and show the markup and script for your modals.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Friends,
we are integration our application with Azure AD.
After integration application is not working in Chrome and Edge browser, but works in IE.
In Chrome and Edge its navigating to login and after successful login getting redited to Internet Information Services (Windows Server) Page.
During debug, found below line gives Object Reference error in Edge and Chrome browser, whereas giving value in IE.
System.Security.Claims.ClaimsPrincipal.Current.FindFirst("preferred_username").Value
Thanks In Advance,
|
|
|
|
|
|
I designed a login page but currently i created users on SQL server that I use as users on the login page.
I will like users to login using their windows authentication.
|
|
|
|
|
|
How to generate enter key press without pressing enter key from the keyboard.
Is it possible using jquery ?
Suppose In C# I found
SendKeys.Send("{ENTER}");
like that how it is possible in jquery or Javascript.
|
|
|
|
|
Member 12160780 wrote: Is it possible using jquery ? No, since it is a security issue.
However, why would you want to? There is very likely a better way to do what you want to do.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Actually I am going to make a web application from where I send a whatsapp message using whatsapp.web. So I send a number and message dynamically and bind with that url. It takes me new tab with specific person(number) and message. Now If I pressed enter key then message can go. For that I need to do this.
Though there is a lots of way to integrate whatsapp message using api or else. But all of them are paid.
|
|
|
|
|
Member 12160780 wrote: . Now If I pressed enter key then message can go Pressing Enter probably is submitting the form so what you can do is google on how to emulate submitting a form with c#. You'll basically do the post yourself.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Hi,
I need help to show information in modal.
<pre><div class="modal fade" id="Modalpopup" onclick="Editar" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Row ID
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save</button>
</div>
</div>
</div>
Function Event click:
eventClick: function (events) {
$('#Modalpopup').modal();
},
<pre><script>
function Editar(id) {
window.location.href = "../Agenda" + id;
}
I have a error in my last code because i use this for show in new page. And now i want show in modal.
|
|
|
|
|
And what is the error?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Not a error in display but error where not push information to modal
|
|
|
|
|
I have no idea what that means.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|