Create Custom Resource Provider?

Mar 4, 2010

I am working on a new project using ASP.NET 4 and I have a few Resource Files.However, I also have resources on a SQL database. I would like to somehow create a common resource provider.I would like to be able to use:

Resources.Labels.Email > This would take the resource Email from file Labels.

Resources.Database("Email") > This would take the resource with name "Email" from the database.When I get a resource from the database I always return the Name, Content and MimeType.To avoid multiple requests I could even have another method like:

Resources.Database(new List<String> { "Email", "Address" }) > This would take the resources with name "Email" and "Address" from the database in one request.I am not sure if this would be possible ... Basically I would need to have something like:

Resources.Database.Load(new List<String> { "Email", "Address" }); And then use: Resources.Database("Email");

And even have one more:Resources.Config("Email") > This would take the resource with name "Email" from th web.config file. Always a String.I have all the code with communication with the database and web.config.The main problem is really how to create this resource interface.

View 1 Replies


Similar Messages:

How To Create A Custom Resource.xml Instead Of Using Resource .resx Implementation

Jun 2, 2010

I will be setting the current thread's culture at the beginning of the request lifecycle.

Does it make sense if I create my own resource.xml to store things like strings/labels/messages that will be used in the web application?

or are their drawbacks and its better if I just use the Global resources .resx files that are 'built-in' ?

View 2 Replies

MVC :: Internationalize DataAnnotations Error Messages Using A Custom Resource Provider?

Mar 18, 2010

Is there a way to use DataAnnotations for validation, particulary in MVC, while relying on a custom resource provider ?

I built a custom SQL based resource provider for the asp.net side of my MVC application. At this point I'm down in the model section and want to use DataAnnotations for validation. Something like ...

[code]....

View 5 Replies

C# - How To Create A Custom Membership Provider For MVC 2

May 5, 2010

How do I create a custom membership for ASP.NET MVC 2 based on the ASP.NET membership provider?

View 5 Replies

Recommend Way To Create A Custom Culture And Associated Resource Files For A Specific Client

Oct 8, 2010

I have client that wants to specifiy their own version of localized content for a subset of my string resources.For simplicity here is basic example:Lets say I have 2 localized strings (showing english content)PageTitle="Hello World" PageDescription="This is a more wordy version of Hello World!"

Strings.resx (contains my English
string)
Strings.fr-ca.resx
(contains my French-Canadian strings)
Strings.fr-ca-clientX.resx (contains
[code]...

View 1 Replies

Security :: How To Create A Custom Membership Provider

Mar 29, 2010

My question relates to membership providers. I have two websites that run on two different servers. One website is a community website that uses Telligent community server 2007. The other is a website that contains information. I have a form where users can request more information. What I would like to do is when a user requests more information, automatically create a user account in my community website. I was told that I can create a custom asp.net membership provider that will create a new user account in my community website. I have read some info at msdn and asp.net websites, but I am still unclear as to how I can create a custom membership provider that will work across different websites running on different servers.

View 1 Replies

ADO.NET :: How To Create A Custom Membership Provider Using Linq To Entities

Dec 18, 2010

any tutorials or materials that to implement a custom membership provider where I can using Linq to Entities for data retrieval in its internals?

View 1 Replies

Security :: Create A Custom Membership Provider Without PassQuestion, PassAnswer

Jul 20, 2010

I want to create a custom membership provider which doesnot has Password Question and Password Answer fields. But has some other extra fields.Is it possible? I am asking this because if I inherit MembershipProvider class then I get forced to use default CreateUser Method which has password question and password answer parameters. I don't want these parameters.

View 1 Replies

VS 2008 Implement Custom Role Provider And Membership Provider

Sep 27, 2010

I have watched the how to video on Creating a Custom Membership provider. So far it works great. My login control interacts well with it etc. Now i've created a Custom Role Provider. I've created a class that inherits the RoleProvider base class and i've added code to each Sub. My question is, what is the best way to implement the role provider, considering I get the Roles etc from the database?

View 11 Replies

Security :: Get User Info With Custom Provider - Use Provider With Profilecommon?

Apr 16, 2010

I try to get the user profile settings with this code. But all items in it are empty, in the database they are not empty. So there is going something wrong. First of oll how can i add a provider to the ProfileCommon ? Maybe i'm there then... the usrInfo is filled well...

MembershipUser usrInfo = Membership.Providers["MyMembershipProvider"].GetUser(UserName,false);
ProfileCommon prf = (ProfileCommon)Profile.GetProfile(UserName);
LitNaam.Text = prf.Voorletters.ToString() + " " + prf.Achternaam.ToString();

View 2 Replies

Security :: Implement custom Role Provider And Membership Provider?

Dec 1, 2010

i have implemented custom role provider and membership provider .

login page : SignIn.aspx

on successful login it redirects to (index-Homepage.aspx)

now PROBLEM is when it successfully logged in ,and redirects to 'index-Homepage.aspx' it gives Anornymoustemplate ..while its verifying the role correctly in index-Homepage.aspx.cs

View 1 Replies

Security :: Big Extension Of Membership Provider - Should Use A New Custom Provider

Mar 27, 2010

i'm building an application and i need to manage roles, users and more things so i tought to use the membership provider but i have some questions about it: can i full extend it and can i override the functions to use a database table to store infos about config or i need to build my own provider?

View 4 Replies

Net SQL Membership Provider Custom Provider Property

Dec 16, 2010

<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
</properties>
</profile>

I have the code snippet above in my webconfig file. I am attempting to set the FirstName property in codebehind on a register.aspx page. Like this:

Profile.FirstName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("FirstName")).Text;

VS says Profile is in System.Web.Profile Namespace. I then use it like this "System.Web.Profile.FirstName", but says first name does not exist in System.Web.Profile.FirstName namespace.

How do I set the property and later retrieve it?

View 3 Replies

Security :: Can Implement Custom MembershipUser/custom Roles And Membership Provider

Oct 13, 2010

I create custom principal for implement logic for users. In identity I store Id, Name. But it abnormally - this classes must use for authenticate and authorize.

I can implement custom MembershipUser, custom Roles and Membership provider.

How to do it? What best practices are?

View 5 Replies

Custom Server Controls :: Custom Control Design Time SiteMap Provider Error?

May 13, 2010

I was referred here by MSDN forums hope this is the right place - I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains

[Code]....

and have tried the SiteMapDataProvider Tag with and without the SiteMapProvider
attribute.Does anybody have (a) any experience with this, or (b) any suggestions as to how to track down the problem?

View 3 Replies

Is There A Way To Call Custom Method Of Custom Role Provider Class

Apr 21, 2010

I have created my own custom role provider class "SGI_RoleProvider" and configured properly.

Everything is working fine.

Suppose that I have added a public method say "SayHello()", then how can i call that. Because if i am using Roles then the method is not displayed. If i am forcefully using that Roles.SayHello() then compiler gives the error.

how can i call this. Because creating a new instance of SGI_RoleProvider is meaningless.

View 1 Replies

Security :: Custom Membership Provider With Custom Controls?

Mar 21, 2010

I'm new to ASP.NET and I don't exactly understand some features.

I have a custom membership provider TestMembershipProvider which inherits from MembershipProvider. It has the following CreateUser method:

[Code]....

It's absolutely simple code.Then I have two text boxes (login, password) and the button to register a new user. I thas a following code:

[Code]....

[Code]....

Authentication in web.config is set like this:

[Code]....

No matter what I write into textboxes, following error is being returned:

The password retrieval question provided is invalid.

I don't know why. Either in web.config or in get RequiresQuestionAndAnswer I have false value. When I instantiate my TestMembershipProvider and call CreateUser directly instead of using static Membership.CreateUser, it works fine. Do I have to use instance of my TestMembershipProvider or did I missed anything?

View 1 Replies

C# - Dispose Of Custom Object From Within Custom Membership Provider?

Apr 16, 2010

I have created my custom MembershipProvider. I have used an instance of the class DBConnect within this provider to handle database functions. Please look at the code below:

public class SGIMembershipProvider : MembershipProvider
{
#region "[ Property Variables ]"
private int newPasswordLength = 8;
private string connectionString;
private string applicationName;
private bool enablePasswordReset;
private bool enablePasswordRetrieval;
private bool requiresQuestionAndAnswer;
private bool requiresUniqueEmail;
private int maxInvalidPasswordAttempts;
private int passwordAttemptWindow;
private MembershipPasswordFormat passwordFormat;
private int minRequiredNonAlphanumericCharacters;
private int minRequiredPasswordLength;
private string passwordStrengthRegularExpression;
private MachineKeySection machineKey;
**private DBConnect dbConn;**
#endregion
.......
public override bool ChangePassword(string username, string oldPassword, string newPassword)
{
if (!ValidateUser(username, oldPassword))
return false;
ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPassword, true);
OnValidatingPassword(args);
if (args.Cancel)
{
if (args.FailureInformation != null)
{
throw args.FailureInformation;
}
else
{
throw new Exception("Change password canceled due to new password validation failure.");
}
}
SqlParameter[] p = new SqlParameter[3];
p[0] = new SqlParameter("@applicationName", applicationName);
p[1] = new SqlParameter("@username", username);
p[2] = new SqlParameter("@password", EncodePassword(newPassword));
bool retval = **dbConn.ExecuteSP("User_ChangePassword", p);**
return retval;
} //ChangePassword
public override void Initialize(string name, NameValueCollection config)
{
if (config == null)
{
throw new ArgumentNullException("config");
}
......
ConnectionStringSettings ConnectionStringSettings = ConfigurationManager.ConnectionStrings[config["connectionStringName"]];
if ((ConnectionStringSettings == null) || (ConnectionStringSettings.ConnectionString.Trim() == String.Empty))
{
throw new ProviderException("Connection string cannot be blank.");
}
connectionString = ConnectionStringSettings.ConnectionString;
**dbConn = new DBConnect(connectionString);
dbConn.ConnectToDB();**
......
} //Initialize
......
} // SGIMembershipProvider

I have instantiated dbConn object within Initialize() event. My problem is that how could i dispose off this object when object of SGIMembershipProvider is disposed off. I know the GC will do this all for me, but I need to explicitly dispose off that object. Even I tried to override Finalize() but there is no such overridable method. I have also tried to create destructor for SGIMembershipProvider.

View 2 Replies

Custom Server Controls :: Get IP With Custom Membership Provider?

Feb 7, 2011

I was made a custom membership provider.

All works good. My problem is Logs.

[Code]....

[Code]....

I dont know how to get user's ip.

I tried these methods...

Dim req as httprequest
ip = req.servervariables("remote_host") 'result = nothing
Dim req as new httprequest
ip = req.servervariables("remote_host") 'result = nothing
Dim req as requestcontext
ip = req.request.servervariables("remote_host") 'result = nothing...

View 2 Replies

Custom Server Controls :: Embedding Resource In UserControl

Feb 16, 2010

I want to embed some image and java script file in usercontrol and extract them with code like this

[Code]....

i tried similar code that use this technique in custom controls , and it works ...

but i want use this technique in usercontrol ,

can any one put a sample source code or explain how can i use this technique in usercontrol ?

View 5 Replies

C# - Custom Control Use Embeded Resource Filename In A Script?

Feb 6, 2011

I have a custom control that has some embeded resources. I need to be able to reference some of the embeded material outside the control in JavaScript. So let's say I have an image file embeded in the control and I have a script outside the control that will do something with that file. How do I reference that filename outside the control?Update: Not sure if this is even possible and I hav enot found any information on it.

View 1 Replies

Custom Server Controls :: Accessing Embedded Resource From IScriptControl?

Dec 1, 2010

My Composite control implements IScriptControl interface.

ScriptReferences java script file does the client-side work, there I want to load a html file inside iFrame.

The Html file is an embedded resource:

([assembly: System.Web.UI.WebResource("Control.Resources.list.htm", "text/html")])

I pass the path of the html to the javascript file via descriptor property:

IEnumerable<ScriptDescriptor> IScriptControl.GetScriptDescriptors()
{
descriptor.AddProperty("iframe", iframe);
return new ScriptDescriptor[] { descriptor };
}

Where iframe is a string that contains the path from the webresource.

Now, in this html file I want to display few images that must be also loaded from resource.

The Question is how to access the resources from this html file?

Do I have to pass every image path as descriptor property?

View 10 Replies

How To Create Resource File In VB.NET

Oct 4, 2010

want to create and use resource file in my application (VB.NET 2008). Can i use .resx file or should i convert it into .resources file? please tel me the steps to create and use resource file in VB.NET with sample code.

View 1 Replies

C# - How To Create Resource Manager

Apr 4, 2010

I would like to create resource manager on my page and use some data stored in my resource files. (default.aspx.resx and default.aspx.en.resx)

System.Resources.ResourceManager myResourceManager = System.Resources.ResourceManager.CreateFileBasedResourceManager("resource",
Server.MapPath("App_LocalResources") + Path.DirectorySeparatorChar, null);
if (User.Identity.IsAuthenticated)
{
Welcome.Text = myResourceManager.GetString("LoggedInWelcomeText");
[code]...

View 2 Replies

How To Create Resource From .net Page

Jul 28, 2010

is it better to create one resource for every asp.net page application. or to create a global resource for all pages?my application has about 100 pages and 200 usercontrols.if i want to create global resource can how can i use this Feature of visual studio 1)Open the page for which you want to create a resource file.2)Switch to Design View 3)In the Tools menu, click Generate Local Resource.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved