Migrate .net 1.1 aspx page into .net4.5 with Japanese characters - asp.net

I am working on a project to convert the current web application built using .Net 1.1 that is being migrated to .Net 4.5 using VS2013.
Most of the existing .aspx files (developed in .Net 1.1) have Japanese characters which are not displaying in the browser properly. When I open the .aspx page in EditPlus it shows the proper Japanese characters. Japanese characters in .cs files appear properly.
I have already changed the Unicode to UTF-8.
When I add a new file to the project and copy the content from the old .aspx file then the Japanese characters appear properly.
What am I missing here that would cause the characters to not appear properly in the browser?

Is the browser receiving UTF-8? (In Firefox open view page info)
Check that the globalization tag of your Web.Config is set to UTF-8.
https://msdn.microsoft.com/en-us/library/ydkak5b9%28v=vs.71%29.aspx

Related

ASP.NET MVC - French/Spanish accent not correctly displayed

I'm working on multilingual website where I want to get language resource from SQL db table. Resource Table column is already set to nvarchar though It's completely strange behavior get junk character when it's getting rendered in MVC View.
û rendered as û
However, It's working fine in my local machine but problem occurs on production environment only. Don't know why!!!
Static & Resource file content of different languages are rendered perfectly fine but the problem occurs only for resources retrieved from SQL table.
Tried setting meta tag with utf-8 charset in page & globalization with request response encoding to utf-8 in web.config but couldn't resolve my problem.
Should it be problem of IIS or Entity Framework is converting it to junk characters? Really confused.....
I'm using MVC4 with Entity Framework.
Any help will be greatly appreciated.

.ASPX pages markups are opening in web browser

When I double click on .aspx pages in my web application project in VS2010, instead of showing the mark up in the ide the .aspx pages are opening in the web browser as shown below. The same is happening when I run my application it opens all the .aspx pages in the web browser along the application url i.e., http://localhost123456/default.aspx. I have to close all the other pages except the http://localhost123456/default.aspx to run/ test my application. Not sure what would cause this to happen. I am not able to find any solutions so far, any help is appreciated. I used the option View Markup (Rightclick on aspx page -> view Markup) to see the markup for now.
Update
As per Mike's answer I checked the options under Open with... and I do have a Internet Explorer (Default) set as shown in the following image. Not sure how did it got there.
Deleting the Internet Explorer (Default) option might be cumbersome if I have lot of .aspx pages , if there is a way to remove this option at once for all .aspx pages rather than right clicking on each and every .aspx and remove it that would be great.
As per #JB King suggestion I did checked the file properties and all the .aspx files are set with Opens with: Microsoft Visual Studio option as shown it the image below.
Right-click any .aspx file in the project, select Open With...
In the screen that pops up, select Web Form Editor, then click the Set as Default button.
Not sure how you got Internet Explorer as an option here, but if it is there, you can just delete it. It's not applicable for loading the aspx from disk. Rather, to see the rendered page in IE, you'd do View in Browser or Browse With... (in which you can set your default browser, as well).
Your address bar shows you're loading files directly from disk. This won't work. ASP.NET is not lilke static HTML. ASP.NET applications must be run from within a webserver. Install IIS and ensure ASP.NET is installed and configured, or use the Debugging Webserver (IIS Express) in Visual Studio.
If you look at the properties of the file, there should be a line of Opens with: that is where you want to have Visual Studio rather than Internet Explorer as the issue is with which programs are mapped to what file extension. Microsoft instructions if you want those as specific steps to do.

Arabic resource files not being picked by ASP.NET web site

I'm working on a project that has a web application module that generates localized emails upon request. The app requires html templates localization for several languages. I decided to go with asp.net resource files since the email layout is not likely to change and the amount of keys needed was relatively small.
I'm using Global Resources and have around 15 different resource files for the required locales. I have my default resource file in English ("EmailTemplates.resx") and then several localized resource files ("EmailTemplates.ru-RU.resx", "EmailTemplates.zh-CN.resx", "EmailTemplates.it-IT.resx", "EmailTemplates.id-ID.resx", etc).
Among the resource files, I have two arabic ones: "EmailTemplates.ar-AE.resx" which is actually in English and "EmailTemplates.ar-SA.resx" which is in Arabic.
All the emails for non Arabic locales work perfectly. The app picks up the required locale and uses the corresponding resource files. But when I try to request the Arabic ones, it always fall back to the default resource file.
The way I'm setting up the culture is based on the data requested, and not the browser settings:
Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
While debugging I can see that the CultureInfo is properly set to "ar-SA" or "ar-AE" but when the app retrieves the corresponding resource value, it always picks up the default one.
I have entered Arabic data in the default resource file for testing purposes, and the Arabic text displays just fine, so I'm sure that it is not a font or HTML layout issue.
I have searched all around the Internet, proved different approaches, and no luck. The "ar-SA" and "ar-AE" are valid CultureInfo values and the app compiles without issues, but it seems that whenever I request the Arabic emails, the app can't find the Arabic resource files.
Any ideas? I'd really appreciate any hits and help !
Cheers!
Please use the language without the culture info
Eg. EmailTemplates.ar.resx
because the browser you are using might not have the Arabic in different cultures as i checked with my chrome .or try adding the language with that culture.example ar-AE ar-SA etc,But anyway it has the Arabic language without culture and it works.

How can I get chrome to stop caching when working on an aspx file in visual studio

I'm currently editing some html/css within a aspx file inside of Visual Studio 2010. I'm using Chrome as my browser. When I make changes inside of Visual Studio and save/ctrl + F5 to run it frequently fails to load the new updated .css file due to pulling old cached versions of the CSS.
I've used visual studio as my primary HTML editor before but when I work with pure html/css files I just save and refresh the file in chrome and it will refresh the updated css 100% of the time. I've only started to experience this problem when working with aspx files and running things via ctrl + f5. Anyone have any ideas of how I can fix this?
Go to project properties, Web tab
Choose Start External Program in the Start Action section
Paste or browse to the path for Google Chrome (Mine is C:\Users\Chris\AppData\Local\Google\Chrome\Application\chrome.exe)
In the Command line arguments box put -incognito
If you would like the browser to open a specific page, then you will need to set the Visual Studio Development Server to use a specific port (ie 4066) then change your command line arguments to include that address, for example: -incognito localhost:4066/Default.aspx
Incognito Mode should prevent caching between sessions and even tabs.

how to open MS Office word in asp.net?

in my application, when user click on particular link button, MS word has to open how can i write the code for this. Thank you
There is no way to guarantee that a particular application will be opened when a user clicks a link / button on a web page. The application that is opened is determined by the user's browser and operating system settings.
As a developer you can specify the MIME type of the file that you are returning. By doing so you are telling the user's browser what file type is contained in the response. W3Schools provides a pretty good MIME type by content type list and FILExt also provides the MIME type for the files it lists.
Assuming you specify the appropriate MIME content-type you can be sure the user's browser and operating system will open the file in the "appropriate" application according to their settings. Since you want to open a Word Document file the appropriate MIME content-type will be one of the following:
Extension Type/sub-type
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
doc application/msword
How and where you specify the content-type largely depends on the ASP.NET application type you are working with. If you are writing a ASP.NET Webforms application you'd change the MIME type of the Response object in the Page_Load method. In an ASP.NET MVC application you'd do so in a controller action. In either case the specific line of code is the same.
Response.ContentType = "application/msword";
When you click on a link, redirect the browser to the file mydoc.docx - the browser will open that in Word as long as they have Word installed. You will also need to maek sure your IIS server has the MIME type setup, see Downloading Docx from IE - Setting MIME Types in IIS
If you are generating the Word document on the fly, you will need to set the MIME type so that the browser knows that the response is a word document. I suggest the docx format for generating content.
If it is a Windows Application, this should work...
System.Diagnostics.Process.Start("FileName.doc");
For a web application, just redirect to the filename on the hosted server, or use one of the ways as described in the post below...
http://www.dotnetscraps.com/dotnetscraps/post/4-ways-to-send-a-PDF-file-to-the-IE-Client-in-ASPNET-20.aspx

Resources