ASP.NET
|
|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
|
|
|
|
|
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;
}
// get the report URL
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:
// get the report URL
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?
|
|
|
|
|
|
|
|
|
|
|
|
General
News
Suggestion
Question
Bug
Answer
Joke
Praise
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.