Forum Discussion
wissDev
Feb 24, 2023Copper Contributor
translate validation message Modal form using ressource file c# not working on server
Hi,
I am working on asp.net mvc c# project.
On the login page, I have a login form and also a link to the "Forgot password" page and also a page to register.
at the top of the page, we have the choice of language, either French or English and the validation of these forms is done via the Modal using 2 resource files with the 2 languages.
Everything I have put in place works well locally but by deploying the project, the part of the translation of error messages from non-functional resource files .. is there any config to do please?
Thank you.
- AddWebSolutionBrass ContributorHi wissDev,
Here you get the solution:
https://learn.microsoft.com/en-us/previous-versions/aspnet/bz9tc508(v=vs.100)
OR
You can also check the below points:
It seems like you're experiencing an issue with the validation message localization when deploying your ASP.NET MVC C# project. Here are some steps you can take to troubleshoot and resolve the issue:
1. Check Resource File Names and Locations:
- Make sure that your resource files are named correctly and are located in the appropriate folders (e.g., `Resources` or `App_GlobalResources`).
2. Check Deployment Environment:
- Ensure that the server environment supports localization. This includes making sure that the appropriate .NET Framework or .NET Core runtime is installed.
3. Verify Resource File Deployment:
- Double-check that your resource files have been deployed along with your application to the server.
4. Verify Culture Settings:
- Ensure that the server's culture settings are correctly configured. This can be done in the server's control panel or through server-wide settings.
5. Check Web.Config:
- In your `Web.config`, ensure that globalization settings are configured correctly. This includes the `culture` and `uiCulture` attributes in the `<system.web>` section.
<system.web>
<globalization culture="auto" uiCulture="auto" />
</system.web>
6. Check for Missing Resource Files:
- Confirm that both resource files (for English and French) are present on the server.
7. Verify Resource Access Permissions:
- Ensure that the application pool identity or user account running the application has appropriate permissions to access the resource files.
8. Check Server Error Logs:
- Review server logs for any error messages related to resource file access or localization.
9. Rebuild and Redeploy:
- Clean and rebuild your project, then redeploy it to the server.
10. Check File Encoding:
- Ensure that the resource files are encoded properly. UTF-8 encoding without BOM is typically recommended.
11. Check for Case Sensitivity:
- Some servers may be case-sensitive, so make sure that the file names are referenced with the correct casing.
12. Clear Server Cache:
- If applicable, clear any server-side caching mechanisms that might be storing old versions of the resource files.
13. Test on a Different Server:
- If possible, try deploying the application on a different server to see if the issue persists. This can help isolate whether the problem is specific to the server environment.
Remember to back up your files before making any changes, and consider testing changes in a non-production environment first. If the issue persists, you may need to consult with your hosting provider or system administrator for further assistance. - LanHuang
Microsoft
Hi wissDev,
Thanks for posting your issue here.
However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang