Localization for user profile information Asp.net - c#

I'm trying to implement page localization to my webpage made in asp.net-mvc. I understand how to implement titles and other modular data.
The problem comes when i want to give user/admin of this page rights to change his personal information/bio on her webpage if needed. Do i save the bio in the database? With another column in the table which indicates for which language it is meant?
Or is there any better solution?

Related

database for arabic and english language MVC SQL

I am developing one application where the client wants to see contents in both arabic and english. The displayed data is retrieving from database SQL.
The question here is If the user saves his details in database in english language, how can i show that data in arabic from database?
How can i achieve this part?
You have to use a translator API and save both the languages to database.
I don't know how you can do that without using some sort of translation service, there is nothing in .NET or SQL server (or any other RDBMS that I know of) that will do that for you.
Here's one (API) that is from Microsoft if you need a place to start: https://www.microsoft.com/en-us/translator/translatorapi.aspx
Depending on your requirements, you may want to translate data immediately and store it into the opposite database; however it may end up being expensive, so if you're able you might choose to translate things on demand to save some costs.
i think An effective way to create localized Web pages is to use resource objects for your page's text and controls. By using properties placed in resource objects, ASP.NET can select the correct property at run time according to the user's language and culture. The process is straightforward:
Resource Files and ASP.NET MVC Projects
fore more info

How can I post a variable from one page to another, completely different page?

So I have an ASP.Net website. I'm trying to make it where the owner of the website can change a portion of her website that is just text. I was thinking to make it a string variable that she can change on one part of the website and it posts on the other part. I tried looking at [this page](http://msdn.microsoft.com/en-us/library/vstudio/ms178139(v=vs.100).aspx"A link to Cross Page posting with ASP.Net Webpages") and the directive it tells me to include isn't recognized. I can get the variable to change and display on the page I changed it with, but have no idea how to make it to where I can use it on another page.
In order to have changes maintained across sessions and application restarts the data will need to be written out to persistent storage. Typically that would be a database, or for simple systems, one or more files.
If you are going allow modification of the site then there are security concerns. A common scenario would be to have an administrative login that allows access to the underlying data.

How do you store custom user data in asp.net?

I may be overlooking a question like this, but I couldn't find it. I have an asp.net site with C# codebehind, and I have a working means of creating user accounts, passwords, and associating other data with each user. I started this site by creating a web application, and the login/register functions were all included and work fine. I also have a database that the user can search and display data on the site (all of this also works). However, I want the user to be able to search the database for data, and then be able to go back to pages that they've saved as pages that they're "following." All I would need to store would be a unique identifier from the database to note that the person wanted to follow that page. Where would be the best place to store these values? Could I do so by saving the data in the aspnetdb database? If so, how would I write custom values in this database if using an asp.net web application?
If you're using ASP.NET's Membership feature, you'll probably want to use the MembershipUser.ProviderKey as the unique ID mentioned by #dcreight. Use it to access your own table. I would not recommend writing into the aspnetdb directly.

Yet another .net custom cms

I'm trying to switch my custom cms written in php into .net c#. I was thinking to use cms as a learning project. I'm going to use C#, NHibernate ORM layer, mssql, mvc3 and jquery.
I'm aware there are plenty of commercials or open source cms, but still I'm going to spend some of my free time trying to learn new technology working on project like this.
So, is there anyone out there who is willing to share some ideas on creating cms domain model, usefull link, ideas, etc.
Thanks
A really basic CMS consist of 3 elements:
one database table to hold your "pages". The table structure is "name" and "content"
a route to transform requests of type /cms/pagename to a fixed controller, the method called cms and pagename as a parameter
a embeddable html editor
Now, there are two ways your "page" can be invoked. It is either create mode or view/edit mode.
In "create" mode, the page is requested but it is not in the database yet (e.g. cms/announcement1). In this mode you create a view consisting of a html editor and upon submit, you persist the page to the database.
In "view" mode, the page is requested and is IS in the database. You perform any necessary rewriting (for example you rewrite internal links of the form [cms/pagename] to a fully routable http address) and render the content.
If the user is authorized to edit the page, you also show a "edit" button which then invokes the html editor with the page loaded and ready to be edited.
And that's it.
There are tons of additional elements (caching, different built-in page types, embedding images, youtubes, preformatted texts) etc. but all of them are optional and you can introduce new features when you have the core already implemented.
Once I wrote a simple CMS following the structure above, it was a part of a bigger solution and till now it's been sucesfully deployed several hundred times. An advantage of a custom CMS is that it can be really simple and easily maintanable.

user comment display on asp.net page

I have an asp.net page which uses the asp membership control. I want to use the user comment field to hold an additional piece of information. I'm creating the user via the Web Site Administration Tool.
So how would I access the comment field and write it to the page?
Ok I'm not totally mad (well maybe but that's my state of mind!).
the comment field lives in the aspnet_Membership table if you create a user and go to manage that user you see it has a Description labelled text box this maps through to the Comment field.
Maybe I'm using the wrong terms! sorry...
I don't quite understand what "comment field" you are talking about, because the default Web Site Administration Tool created users don't have such fields.
If you want to create such a field you would need to implement different MembershipProvider class or work with Profile properties
I would recommend you to read these articles first:
Examining ASP.NET's Membership, Roles, and Profile
Storing Additional User Information
EDIT:
For that particular "Description" field (wich I'm sure wasn't there when I was looking for it >.<), it really puts data into "aspnet_Membership" table "Comment" column.
You can easily access it with MembershipUser class:
#{MembershipUser user = Membership.GetUser();}
#if ( user != null)
{
#user.Comment
}
Razor syntax
EDIT
Membership.GetUser() support simple overrides so you don't really need to use Context.User.Identity.Name as parameter for currently logged-on user.
Gotta go with Ilya on this one... I'm not seeing a "comment" field in my instance of Web Site Adminstration.
But, a possible answer to your question would be ASP.NET Profiles:
http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx

Categories