ASP.net webpages for multi Language support in caption texts - asp.net

I am new for the ASP.net.
I have to build the web pages that will support Marathi language captions.
I am using DIV tag for viewing the text in English in .aspx file. Now these text is need to be replaced by Marathi text.
Please guide how can i do that.
Thank you.

Resource files (.resx) may help you. Store all texts in resource files, and categorize them for each language (for instance, on folder for each language).
Suppose you have a folder "en" and in that folder a resource file "myResourceFile.resx". Then you can read them as follows:
HttpContext.GetGlobalResourceObject("en/myResourceFile", "myDivText");

Related

Classic ASP: How to save content of a page?

I need to create a script that generates some URL's from a specific website and copy of its content to somewhere like as txt to parse some data from it afterward. I am able to generate URL's but I have no idea how to get the pages content to a text file.
I am using classic asp and I will be appreciated if you could give me an example on how to do it.
The page I need to copy contains only plain text, which is safe to keep in a text
you want to use the Fil System Object, here's a thorough example from 4Guys:
https://web.archive.org/web/20210506122630/http://www.4guysfromrolla.com/webtech/040699-1.shtml
One thing to note that I've seen people run into problems with, and that's permissions. In the url tutorial above, they mention saving to your c: root for a file location:
set myFile = fso.CreateTextFile("C:\test.txt", true)
Unless you set up special permissions in the root of your C:\ drive, which I'd strongly recommend NOT doing as it's a hge potential security risk, it will not work. I would recommend creating a folder off of the root of your web site, as permissions will probably already be in place (this is obviously reliant on what your requirements are as I'm just guessing).

HtmlEncode Local resources

I have a web site that uses local resources. The main text (so not the labels, etc.) on de default page is stored in a file. This file is added to my local resources file default.aspx.fi-FI.resx and is named text-defaultPage. It's a regular text file with tags etc.
The problem is however, that the text is Finnish in other words it uses a lot of characters having umlaut (รค) and other special characters.
The person for whom the web site is wants to edit this text himself but he doesn't know anything about programming, html entities etc.
Is there a way to make it so that those characters are encoded with say htmlEncode?
in my Global.asax I check for the selected language and the page gets reload with that language.
Edit
Never mind, I made the files Unicode text files.
Solution to the problem is make the files unicode.

Reading an e pub file

I have files in e pub format. I have to show their contents to the user. How do I read them in asp.net? Can it be done through javascript?
Authoritative? What could be better then a StackOverflow answer? I started from this question ( https://stackoverflow.com/questions/4870594/is-there-a-c-sharp-epub-library ) and gleaned a few usefull links:
Usefull information on displaying text in a web browser using javascript so it paginates nicely: HTML book-like pagination
A C# open source library for reading ePub files, the sample code on the home page includes how to get the contents as HTML: http://epubreader.codeplex.com/
There are other libraries which may come in handy if the ePub reader library on codeplex doesn't pan out: http://sourceforge.net/projects/epubsharp/, and http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx
You can't do this with just JavaScript of course, you'll have a server side like a web service or code behind on your asp.net webpage which opens the epub file, extracts the contents as HTML and returns it to the client, but I think there is enough here to get you started.
Just to add then i suggest the steps:
Step 1: unzip the file using C#,.net code having some third party library.
Refer : recommend a library/API to unzip file in C#
Step 2: Check whether in the extracted folder there is only one file or more.
Refer: How do I find out how many files are in a directory?
Step 3 :Read the file using stream reader in c#.net
Refer: http://msdn.microsoft.com/en-us/library/aa328963(v=vs.71).aspx
http://www.dotnetperls.com/streamreader
Epub file is actually a zip archive that contains
xml files for meta data, table of contents etc
xhtml or dtbook (xml) + gif, jpeg, png, svg + css for content
To be able to display epub you will have to be able to handle all of the above. Here Reading ePub format you'll find what you have to do to open epub step by step - it's an example for iphone, but it should be enough.

Regarding CMS concept and html editor in asp.net

we create page through html editor in CMS project. when we design pages then we can add image through html editor. so i just want to know how automatically image path will be stored in my database table and image will upload in proper forlder. suppose i work with fckeditor.
fckeditor can automatically upload images in right folder and how images path will be saved in right table. do i need to parse the html and extract images and replace the image path with properly and atlast upload images programatically to right folder on server before saving the html to databased. please discuss this in detail because i never work with CMS before.
what is the best html editor for CMS and asp.net project.
also tell me what the best free open source CMS for asp.net.
thanks.

Using PDF In .Net App

Can someone point me to some code/tutorial on how to upload pdf files and store them, then moreover how to use a pdf reader to display the file as read only in an asp.net application.
Is there a PDF reader already in the visual studio toolbox?
The approach I would use in this situation is to upload the PDF as you would any other file, then use a tool like GhostScript to convert the PDF pages into image files that you can show in ASP .Net.
Here's a tutorial doing that in C# http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx
Adobe provides (on acrobat.com) a free service which provides you with the ability to upload pdf (and also other types like doc...) and then embed a nice flash interface for displaying the files on your page.
It's pretty helpful as you can store some 5 gigs of files here.
But if you want to let the users upload their own files then this won't help you.
PDF is a final format file, ie its is read-only for the most part and can be embedded into the page via the <object> tag, except if you mean downloadable by the user.
Displaying PDF is generally done by rasterising to an image format for display (ie as an image on the page or via a richer interface (with zooming etc) through flash/silverlight etc.
You can use [GhostScript][1] to interpret PDF files and convert them to an image.
[1]: http://www.GhostScript .com
Uploading a PDF is just like any other file. Use the ASP.NET file uploader control:
http://www.codeproject.com/KB/aspnet/fileupload.aspx
In order to view the PDF in an ASP.NET application, you could either depend on Acrobat being there or use a PDF Viewer control.
The company I work for, Atalasoft, sells a PDF Reader add-on to our web viewer controls. You can learn more here: http://www.atalasoft.com/products/dotimage/pdf-reader

Resources