Membership Store VB.NET Helper Class

Jan 24, 2011

I need to use the standard ASP.NET membership database tables in plain winform projects, and I DO NOT WANT to add the ASP.NET dll, because my app must run with .NET Client framework, and not full framework. Does somebody knows of a helper class that links to ASP.NET tables in plain vanilla VB ot c# code? I mean with functions equivalent to CreateNewUser, CheckUserCredentials, isUserinRole, RoleList etc...

View 1 Replies


Similar Messages:

C# - Store Class Instance (helper Class) In Cache?

Jun 30, 2010

I have a class instance which is created by using Activator.CreateInstance() method. That class instance contains helper methods which are frequently used throughout the application. In order to avoid creating the instance multiple times, I'm just thinking about implementing an appropriate caching mechanism. The following consideration should be taken into account:

1) I can't use static class and methods.
2) There are around 6 instances (1 instance per class) per App Domain.

View 4 Replies

Store Helper Classes In A Separate Assembly?

Feb 21, 2010

I just want to know if anyone stores their helper classes or methods in a separate assembly and why...just for clean management of them? I've seen so many posts about using a helper folder inside your MVC project and that brings me back to the messy old days in ASP.NET where people were using an App_code folder instead of cleanly separating things out physically like this into its own project. And likewise nobody doing real architecture is going to put models in some folder in your MVC web assembly. They would go in MyApp.DataLayer assembly or MyApp.Models or something like this.

View 5 Replies

Jquery - Where Helper Class Cannot Be Used

Jul 1, 2010

I wanted to write a code for JQgrid in asp.net .I have tried the same in asp.net MVC,but i want it now in asp.net .n MVC we use Helper class,and return json data,so what to do in asp.net where helper class can not be used.Serialization can be done with data to get it in json.,but what about Htmlhelper.

View 2 Replies

Helper Class For Sql Server Database

Mar 30, 2011

When is it appropriate to create a helper class for a sql server database using the asp.net framework? Basically I'm trying to create a minature wiki (with multiple pages) and storing all of the data/strings for a specific page into a table on it's own.

View 3 Replies

Best Way To Generate Url Via Page.GetRouteUrl In A Helper Class?

Nov 5, 2010

I have just added routing in a new asp.net 4 web forms application, and have got my route table set up ok and page requests are working fine. What I now want to do is use the Page.GetRouteUrl method whenever I need to generate one of my seo friendly Url's. I started to implement this across various pages then thought it might cut down on code a bit if I had a method in one of my own helper classes, that constructs this url (using the Page.GetRouteUrl method) as I might have several parameters that need to be specified against the Page.GetRouteUrl method each time.

However, within my helper class, it doesn't know what 'Page' is. I was thinking I could pass in 'Page' from the page that wants a routed url to be generated, but in some cases I want to construct one of these Url's in another class which doesn't know what 'Page' is, and in that scenario wouldn't be able to pass it in as a param (and therefore wouldn't be able to use the Page.GetRouteUrl within my helper class). What is the normal approach when wanting to use Page.GetRouteUrl within classes that don't have an instance of the Page object?

View 1 Replies

Tightly Integrated Private Helper Class

Jun 30, 2010

I'm working on a page with two sets of collapsable panels. using nHibernate) I get category objects with a list of items in them, and for each category generate a left panel and right panel. In both panels, there is a ListBox. Items are pre-populated to the left list box and the user can select and move items into the right list box (under the corresponding category.) As I've built and worked on it, I ended up with a lot of generic methods like buildPanel(side,categoryID) and then ended up with a lot of repeated if statements inside them to differentiate between the two sides

if type=PanelType.Left then
set these 5 id strings to access components
else
...

The code got messy, so I moved a lot of the logic and static builder strings for the component ids into a private helper class in order to make other parts of the main class easier to read and follow. The problem I see is that the private class is extremely dependant on specific structures in the parent class. There's a very minimal amount of encapsulation going on and I'm possibly making the logic harder to follow even if the individual components in the code are easier to read.

My question is: When you're using a private class like this, is it acceptable to have it tightly integrated with the parent class (since it's private and implemented in the same file), am I better to refactor again and find a way of either simplifying my original code to be as short as possible without the helper class (stick all category/panel functions in one spot and hide them in their own region when I'm not using them), or should I move towards putting more of the logic in the helper class and simply mapping my events directly to the subclass. After typing all this out, I'm leaning towards the last option, but I'm still torn/confused about the whole thing...

View 2 Replies

Helper Class For Creating HTML Emails In .NET?

Mar 2, 2011

I was using the default MailMessage and SmtpClient classes for creating and sending HTML emails from a web forms website. The problem is I have a lot of hard coded HTML for formatting the email that gets sent. Is there a class that helps format emails for .NET?

View 2 Replies

Feed The Language Culture Thread Into The Helper Class?

Feb 3, 2010

With asp.net MVC 2, I have been trying to get Matt Hawley's Localization helper to work in my web application, but I am getting stuck feeding a null into the Language string variable. I can't figure out why I am doing this.

namespace MvcLocalization
{
public abstract class LocalizedControllerBase : Controller
{
public String LanguageCode { get; private set; }
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
LanguageCode = requestContext.RouteData.Values["languageCode"].ToString();
if ( !AppConfig.SupportedLanguages.Contains(LanguageCode) )
LanguageCode = AppConfig.DefaultLanguageCode;
System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture(LanguageCode);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
base.Execute(requestContext);
}
}
}

View 1 Replies

Web Forms :: Pass An Event Handler To Helper Class?

Sep 18, 2010

I have a static class (an helper class) which has the responsability to create control and add them to a panel passed by parameter, this method is used by a lot of

View 5 Replies

Web Forms :: Passing A Content Page ByRef To Helper Class - Can't Find Controls

Dec 17, 2010

Is there a way to pass a reference of a page to a helper class? Scenario: [ASP.NET 2.0 Web Application] The page is a content page which has a MasterPage. The page calls a method in the helper class and passes the page byRef as an argument. The method in the helper class tries to find a control on the passed in page and set values. Problem: Only the MasterPage is being exposed and not the page I am trying to pass. Any recommendations on passing the page so that I can set the values of the controls within it?

View 5 Replies

Access :: Data Access Class / Helper Class For Access Databases?

Mar 15, 2011

recommend a data access class / helper class for Access databases, similar to the sqlhelper class found in the (Data Access Application Block)?

View 6 Replies

" SQL Helper Class " In Microsoft Application Blocks For .NET Is Excellent?

Jan 23, 2010

from years go i use "SQL Helper" class that exist in Microsoft Application Blocks for .NET and i used it for about 1 year in many projects but after that many senior recommend me not to use as it's have many problems in big projects and i let it but know in a new company they want to use it in a projects ... Could any make his recommendations about it / and if it's really excellent to use it have already issues ?Is there any other good solution rather than SQL Helper ?

View 2 Replies

MVC :: Implement Paging - Create A Helper Class "Server Error In '/' Application"

Jan 4, 2011

To be able to implement paging i need to create a helper class (as mentioned on one example in the net ); so i have created a class that encapsulate the paging logic

public class PagingList<T> : List<T>
.
..

but when i reference this class in my view using the code below:-

Models.PagingList<Article>

The following error occurred. Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0246: The type or namespace name 'Article' could not be found (are you missing a using directive or an assembly reference?) Source Error:

[Code]....

Source File: c:UsersMohannadAppDataLocalTempTemporary ASP.NET Files
oot1f3f505f568b8e69App_Web_index.aspx.82d38c66.ffjpt45i.0.cs Line: 172
Show Detailed Compiler Output:

View 9 Replies

How To Store Custom Data In Membership Cookie

Jul 14, 2010

give me an example (or point me in the right direction) on how to store custom data in an ASP.NET Membership cookie? I need to add some custom properties like UserID and URLSlug to the cookie and be able to retrieve the information in the same way one would retrieve the Username.

Edit:

I used Code Poet's example and came up with the following.

When I set a breakpoint at Dim SerializedUser As String = SerializeUser(userData) the value of userData is right. It has all the properties I expect it to have.

The problem I'm now running into is that when I get to Dim userdata As String = authTicket.UserData (breakpoint), the value is "". I'd love to figure out what I'm doing wrong.

Here's the code.

Imports System
Imports System.Web
Imports System.Web.Security
Namespace Utilities.Authentication
Public NotInheritable Class CustomAuthentication
Private Sub New()
End Sub
Public Shared Function CreateAuthCookie(ByVal userName As String, ByVal userData As Domain.Models.UserSessionModel, ByVal persistent As Boolean) As HttpCookie
Dim issued As DateTime = DateTime.Now
''# formsAuth does not expose timeout!? have to hack around the
''# spoiled parts and keep moving..
Dim fooCookie As HttpCookie = FormsAuthentication.GetAuthCookie("foo", True)
Dim formsTimeout As Integer = Convert.ToInt32((fooCookie.Expires - DateTime.Now).TotalMinutes)
Dim expiration As DateTime = DateTime.Now.AddMinutes(formsTimeout)
Dim cookiePath As String = FormsAuthentication.FormsCookiePath
Dim SerializedUser As String = SerializeUser(userData)
Dim ticket = New FormsAuthenticationTicket(0, userName, issued, expiration, True, SerializedUser, cookiePath)
Return CreateAuthCookie(ticket, expiration, persistent)
End Function
Public Shared Function CreateAuthCookie(ByVal ticket As FormsAuthenticationTicket, ByVal expiration As DateTime, ByVal persistent As Boolean) As HttpCookie
Dim creamyFilling As String = FormsAuthentication.Encrypt(ticket)
Dim cookie = New HttpCookie(FormsAuthentication.FormsCookieName, creamyFilling) With { _
.Domain = FormsAuthentication.CookieDomain, _
.Path = FormsAuthentication.FormsCookiePath _
}
If persistent Then
cookie.Expires = expiration
End If
Return cookie
End Function
Public Shared Function RetrieveAuthUser() As Domain.Models.UserSessionModel
Dim cookieName As String = FormsAuthentication.FormsCookieName
Dim authCookie As HttpCookie = HttpContext.Current.Request.Cookies(cookieName)
Dim authTicket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(authCookie.Value)
Dim userdata As String = authTicket.UserData
Dim usersessionmodel As New Domain.Models.UserSessionModel
usersessionmodel = DeserializeUser(userdata)
Return usersessionmodel
End Function
Private Shared Function SerializeUser(ByVal usersessionmodel As Domain.Models.UserSessionModel) As String
Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Dim mem As New IO.MemoryStream
bf.Serialize(mem, usersessionmodel)
Return Convert.ToBase64String(mem.ToArray())
End Function
Private Shared Function DeserializeUser(ByVal serializedusersessionmodel As String) As Domain.Models.UserSessionModel
Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Dim mem As New IO.MemoryStream(Convert.FromBase64String(serializedusersessionmodel))
Return DirectCast(bf.Deserialize(mem), Domain.Models.UserSessionModel)
End Function
End Class
End Namespace
Here's where I create all the magic. This method is in a "BaseController" class that inherits System.Web.Mvc.Controller
Protected Overrides Function CreateActionInvoker() As System.Web.Mvc.IActionInvoker
If User.Identity.IsAuthenticated Then ''# this if statement will eventually also check to make sure that the cookie actually exists.
Dim sessionuser As Domain.Models.UserSessionModel = New Domain.Models.UserSessionModel(OpenIdService.GetOpenId(HttpContext.User.Identity.Name).User)
HttpContext.Response.Cookies.Add(UrbanNow.Core.Utilities.Authentication.CustomAuthentication.CreateAuthCookie(HttpContext.User.Identity.Name, sessionuser, True))
End If
End Function
And here's how I try and retrieve the info.
Dim user As Domain.Models.UserSessionModel = CustomAuthentication.RetrieveAuthUser

View 2 Replies

Security :: How To Delete Users From The Membership Store

Jun 29, 2010

I have been diligently learning all about the asp.net membership framework and have a test site running it all. However, during my testing, it became apparent that deleting users would be useful. I can delete users from the "aspnet_users" & "aspnet_Membership" tables simply by right-clicking on the table in server explorer, selecting "show table data", highlight the rows and press delete!!

However, this is a pain and I would much rather do this properly from code behind.

I have found out that the membership schema supplies a large number of "stored procedures" including "Delete_Users" however, when I execute this one manually, I have no idea what the last two parameters are (number of tables and something else from memory - the first two "application name" and "username" are easy to copy in to the dialog.

show me a sample set of VB code that I can use behind a "Delete User" button on my webform including how I supply the parameters. I have set up a drop down list box from teh "aspnet_users" table which displays the "UserName" and has as the SelectedValue "UserId".

View 3 Replies

Security :: Store Last Implicit Login Without Membership Api?

Jul 25, 2010

we use forms authentication for a community website with about 200k users with a simple login like this:

Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
If CheckPassword(txtEmail.Text, txtPassword.Text)
FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, chkRememberMe.Checked)
End If
End Sub

which checkPassword reads from a MS SQL users table. it has worked without major problems for 3 years but we need to store the login date of users in a table, both when they login explicitly and when they had selected "remember me" and come back (we store login once per session)

since we have a complicated profile system and database it will be practically impossible to switch to membership API. last time I was told we could user an auditing system to do that but I have no idea how to do that.

View 2 Replies

Using SQL Membership Provider - Store Own Per - User Data?

Mar 27, 2010

I'm using the ASP.NET SQL Membership Provider. So, there's an aspnet_Users table that has details of each of my users. (Actually, the aspnet_Membership table seems to contain most of the actual data). I now want to store some per-user information in my database, so I thought I'd just create a new table with a UserId (GUID) column and an FK relationship to aspnet_Users. However, I then discovered that I can't easily get access to the UserId since it's not exposed via the membership API. (I know I can access it via the ProviderUserKey, but it seems like the API is abstracting away the internal UserID in favor of the UserName, and I don't want to go too far against the grain).

So, I thought I should instead put a LoweredUserName column in my table, and create an FK relationship to aspnet_Users using that. Bzzzt. Wrong again, because while there is a unique index in aspnet_Users that includes the LoweredUserName, it also includes the ApplicationId - so in order to create my FK relationship, I'd need to have an ApplicationId column in my table too. At first I thought: fine, I'm only dealing with a single application, so I'll just add such a column and give it a default value. Then I realised that the ApplicationId is a GUID, so it'd be a pain to do this. Not hard exactly, but until I roll out my DB I can't predict what the GUID is going to be. I feel like I'm missing something, or going about things the wrong way. What am I supposed to do?

View 3 Replies

Security :: Change Database To Store The Membership Information?

Jan 1, 2010

while creating users/groups using web site administration tool, is there a way to configure it to store to a specific database rather than store to a Microsoft SQL 2005 Server Express Edition by default in the App_Data folder?

View 2 Replies

Security :: Use Membership Store For User Settings With Windows Authentication

Sep 1, 2010

I am evaluating ASP.NET Membership for an intranet Silverlight app. I want users to be automatically authenticated for my application with their windows logon. Thus I configured Windows Authentication. I would like to store user settings like email-address in using the SqlMembershipProvider and not AD. It seems that storing user settings using the SqlMembershipProvider is not supported with Windows Authentication. Is this really so (using .NET 4)?

If so: What is the rationale behind this? IMHO authentication, user settings and authorization are distinct aspects. User settings could easily be stored (identified by user name) using the SqlMembershipProvider with authentication and password management being supplied by Windows. What is the recommended solution for my scenario?

View 2 Replies

C# - Membership Provider Class?

Jan 26, 2010

I want to know how I can implement membership provider class to have ability to remember users who signed in. I have Membership provider class and I need functionality of "Remember Me" checkbox but I don't know how I can implement some methods

View 3 Replies

C# - How To Use Membership Provider Class

Jan 15, 2011

i want to use asp.net membership provider for my own database i have own table here is what have i done i extended the membership provider class with my own write all overided methords. is it right way to use membership provider class for custom use?? i also extend the rolemanagement class too.

View 2 Replies

Security :: How To Delete Users When Using The Membership Class

Jan 19, 2010

I currently built a custom form using VS 2005 to accommodate administrators when deleting users from the membership "aspnetdb" database.

I set the method for the objectDataSource to use "DeleteUser(String username, Boolean delete All Related Data), returns Boolean".

When I run the application and click the delete link from my gridview I receive the following error message:

"Value cannot be null. Parameter name: username"

How do I get the value for username?

View 5 Replies

Security :: Overriding A Method From Membership Class ?

Feb 13, 2011

I'm new to MVC and I have a question and I need your inputs.I have this portion of code inside a method (let me just call this MyMethod):

[Code]....

where I am simply using the default CreateUser method from default Membership class to create a new user. This method simply adds the user on the default membership table. Now I have another table which I call userDetails table and I am hoping to add additional information related to the user recently added on the membership table.I can simply add more codes inside MyMethod to do the above logic of adding the additional information to another table. However I was thinking that if I do this... and I delete the user using the ASP.Net Web Application Administration Tool, I may end up with orphan entry on my userDetails table after the user is deleted from the membership table (since the administration tool wouldn't know MyMethod and use the default method from Membership class).So is there a way I can override the CreateUser method from the System.Web.Security.Membership class such that it goes through this flow?

1. invoke the original or base CreateUser method (the user is now created during this step)

2. determine user_id of the newly-added user on membership table.

3. add more user-related information on another table example: userDetails table.

This way, every time I call the CreateUser method it automatically adds the necessary entries on the membership and userDetails tables.If I create my own membership class inheriting from the original class, it would mean a lot work rewriting lots of methods when in reality what I'm trying to achieve is only adding additional information related to the user. I tried modifying the default membership table from the provider database but I get and error during the user-creation process. This gives me the impression that I am not allowed to modify the existing tables... which would lead me to creating a custom provider.

View 2 Replies

Postback - Store Object Class In Viewstate (or Other Ideas)

Sep 8, 2010

I've build a class like this:

[code]....

The values of this class are set at postback by clicking a radiobutton list. Problem however is I don't know how to save this values across multiple postbacks. I thought of using viewstate but I'm not quite sure how to do it with this class.

Maybe I'm missing some important thing here.

Hope someone can point me in the right direction.

View 4 Replies







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