0

I created a website in ASP.NET MVC using C# and published on a Windows Server 2016 with IIS 10.

I get this error:

HTTP Error 403.14_Forbiden

I don't want to show the directory. My website works on localhost, but it's not working on the server.

Before that I got the same error and I changed the connection string and it worked but now I forgot what I did before to make it work.

I guess the problem is in my connection string but I can't fix this.

I installed .NET on the server and I guess server is fine but connection string have a problem.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

2 Answers2

1

I am posting this answer based on your comment about the connection string. If you think that the issue is related to the connection string, then you can do the following checks.

  • Ensure the connection string in your web.config file is correct and points to the appropriate database server.
  • You need to check that the database server is accessible from the server where your website is hosted. Also, there are no firewall restrictions or network connectivity issues.
  • Check that the credentials specified in the connection string have sufficient privileges to connect to the database.
Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197
  • Thats my problem, i cant figured out whats is wrong. Base on past problem i quess the connection string is the problem. Can you write a correct connection string? – Hamed Javadi Jul 09 '23 at 09:04
  • Its difficult to provide you the correct connection string, but you can follow this page https://www.connectionstrings.com/sqlconnection/ – Vivek Nuna Jul 09 '23 at 09:23
0

This error usually occurs when the server received the request from the client and understood it but cannot find a default resource to return to the client, please make sure there is a default page or document in the server directory where the website is hosted. An example of a default page the server looks for to serve to the client is index.cshtml and an example of a default document the server looks for to serve to the client is index.html. Make sure either of those are in the default server directory where the website is hosted and then you can add the following line to your Program.cs file if you are using razor pages.

app.MapFallBackToPage("/Index");
Son of Man
  • 1,213
  • 2
  • 7
  • 27