C# - Best Practice To Create A Generic User Id?

Jun 21, 2010

What s the best way to implement a method that creates and assings ID s to user on a asp.net application?

I was thinking about using DateTime ticks and thread id

I wanna make sure that there is no collision and user ids are unique.

ID can be a string or long.

should i use MD5 on some information that i collect from user? what would that be?

I have seen that md5 collision rate is very low.

View 3 Replies


Similar Messages:

Create A User Control That Accepts A Generic List Of CustomObject As A Bindable Property?

Sep 9, 2010

I am trying to create a User Control that accepts a generic List of CustomObject as a bindable property.

I'd like it to look a little somthing like this :

TabularReport.ascx
[Bindable (true)]
public IList<T> Source
{
get;
set;
}
protected void Page_Load(object sender, EventArgs e).........

View 1 Replies

Best Practice In User Uploaded Documents?

Jan 8, 2011

I am embarking on a project that allows a few administators to upload various files and then make them viewable to a subset of the other users that can login to the site. I'm planning on using ASP.NET MVC and was wondering what the best way would be to store the files? Two thoughts came to mind, storing direcly on the server in a folder and storing them in a SQL database.

The first seems like it might be the most logical but how do you prevent an authenticated user from simply typing in the address of a file that they are not permitted to view. My first thought was to setup the folder so that it would be browsed directly via the web.config, but then how does the user view the files they are supposed to view?

Alternatively, I figured if I stored the files in a SQL server, this would prevent the problem just presented but then how does one take, say a PDF file, store it in the database and then render it to a webpage when requested. Secondly, is this efficient to store files in a SQL server?

View 2 Replies

C# - Best Practice Or Design Pattern For User Registration ?

May 2, 2010

We have a big portal that needs user registration to allow them use its services. It's already done in .NET and SOL Server 2005. we are in the phase now of discovering all the problems of the current registration system to build a new robust flexible one that can be extended easily and can be more usable for all services.

View 3 Replies

C# - Databinding Best Practice For User Controls In Web Forms?

Mar 3, 2010

I was wondering about some best practices for data binding in web forms. For example we have a control:

public partial class MyUserControl : UserControl
{
public override void DataBind()
{[code]...

If we wanted that control to bind its data automatically we would do something like this:

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)[code]...

In the first section of code if we do our data binding before the call to base.DataBind() (#1) then that means that, if for example we databind a ListView, we don't have to call ListView.DataBind() because when we call base.DataBind() on our control it recursively calls DataBind on all child controls. Also, we won't have access to any of the properties of the control that were assigned to it using the data binding code blocks <%# %>

If we do our binding on our controls after base.DataBind() (#2) then this means that DataBind is called on these controls twice. Once when base.DataBind() is called, and the second time when we are forced to call control.DataBind(). I can follow here that I don't know about?

EDIT: Looking at this page:
http://msdn.microsoft.com/en-us/library/w5e5992d.aspx

Use this method to bind data from a source to a server control. This method is commonly used after retrieving a data set through a database query. The method is primarily used by control developers; most controls perform data binding automatically.It appears that best practice is to bind controls data automatically. Databinding is for when we explicitly set a data source.

View 1 Replies

Custom Server Controls :: Composite User Web Control - Properties - Best Practice

Jan 12, 2011

I would like to ask you what is the best practice for developing composite user web control with multiple controls inside from the stand point of dealing with properieties. In my situation I would like to use header menu bar with logos, buttons, java baset visible/hidden menus itc as web control. I was successfull in implementing new control in my project.

But my question goes to issue of properties for ALL OF controls. I know how to hard code all required properties like: text, visible, enable for all controls. It's a lot of work. ( This is the very edge of my asp.net comprehension ) Is there a more elegant way provide an access to controls's properties without hard coding seperatelly?

View 12 Replies

ADO.NET :: How To Create A Generic Lambda Expression

Oct 26, 2010

I Use entity framework 4.

Here is my model

Language
LangID
LangName
Product
PrdID
IsActive
ProductText
PrdID
LangID
Text
Category
CatID
IsActive
CategoryText
CatID
LangID
Text

Each time I want the text for one of these model, I execute this lambda expression p=> p.LangID == 1

Is it possible to create a generic lambda expression function that all of these model can use.?

View 1 Replies

Create Generic Class From System.Web.Mvc.ViewPage?

Apr 30, 2010

How can I create generic class from System.Web.Mvc.ViewPage?

View 1 Replies

How To Create Generic Web.config File For Different Web Servers Web Application

Jul 13, 2010

I want to create a generic web.config file for different web servers in VB.NET. So, depending on the server configuration requirements, applications can retrieve all values from that generic configuration file.

Is this possible? How would I do this?

View 5 Replies

Create A Generic Util Function To Be Used In Eval Page?

Mar 16, 2010

I am currently binding a Nullable bit column to a listview control. When you declare a list view item I need to handle the case when the null value is used instead of just true or false.

<asp:Checkbox ID="Chk1" runat="server"
Checked='<%# HandleNullableBool(Eval("IsUsed")) %>' />

Then in the page I add a HandleNullableBool() function inside the ASPX page.

protected static bool HandleNullableBool(object value)
{
return (value == null) ? false : (bool)value;
}

This works fine but I need to use this in several pages so I tried creating a utility class with a static HandleNullableBool. But using it in the asp page does not work. Is there a way to do this in another class instead of the ASPX page?

<asp:Checkbox ID="Chk1" runat="server"
Checked='<%# Util.HandleNullableBool(Eval("IsUsed")) %>' />

View 1 Replies

C# - Create A Business Model Wrapper For A Generic Database Approach?

Mar 10, 2011

I'm currently facing a performance problem with creating POCO objects from my database. I'm using Entity Framework 4 as OR-Mapper. The whole application is a prototype for now. Let's assume I want to have some business objects like classes 'Printer' or 'Scanner'. Both classes inherit from a BaseClass called Product.
The business classes exist.

I try to use a more generic database approach. I don't want to create tables for "Printer" nor "Scanner". I want to have 3 tables: One called Product, and the other Property and PropertyValue (which stores all assigned values to a specific Product). In my business layer I do create a specific object like this:

public Printer GetPrinter(int IDProduct)
{
Printer item = new Printer();
// get the product object with EF
// get all PropertyValues
// (with Reflection) foreach property in item.GetType().GetProperties
// {
// property.SetValue("specific value")
// }
return item;
}

This is how the EF model looks like: Works fine so far. For now I'm doing performance tests for retrieving multiple sets. I've created a prototype and improved it several times to increase the performance. It is still far away from being usable. I takes 919ms to create 300 objects who only contain 3 properties. The reason for choosing such DB design is to have a generic database design. Adding new properties should only be done in the business model.

Am I just being too stupid to create a performant way of retrieving xx objects or is my approach totally wrong? As far as I understand OR-Mapper, they are basically doing the same?

View 2 Replies

C# - How To Create A Extension Method To Sum Up A Column Of A Generic Constrained Type In A Datatable

Oct 1, 2010

Is something like the below possible?

public static T Sum<T>(this DataTable dt, string columnName)
where T : IEnumerable<decimal>, IComparable<decimal>[code]....

It feels like i'm almost there, but not quite :/

Just trying to sum up either decimal or int values in a column in datatable. Currently getting a compile error, however think this is due to the incorrect generic constraint.

View 3 Replies

C# -pass A Generic Type With The User Control?

Aug 19, 2010

In Asp.net Web forms why must a user control be partial? I tried to remove the partial keyword and it says: Missing partial modifier on declaration of type 'test'; another partial declaration of this type exists
Where is the other declaration?I am trying to pass a generic type with the user control how can I do that? I can't unless I change the other declaration too. I couldn't find it so I removed the partial keyword.Note:
you do have 3 files if your making WebApplication but if your making website you only get 2 files?
UserControl.ascx
UserControl.ascx.cs
so in website where is the other declaration?the reason i want generic is because im making a Grid User Control so i want to pass the type the datasource is going to have.

View 4 Replies

C# - Creating A Generic Data Editing User Control?

Feb 11, 2010

I have a user control which has a Gridview and a listview, I want to make this control generic so that I can just pass the type of the class I want to edit, which would be a linq entity, and then it would automatically do the rest, so far I havent had any success and I was wondering if anybody knows a tutorial or some info about doing this?

View 1 Replies

Web Forms :: Disabling The Create User Button In The Create User Wizard

Jan 7, 2010

Does anyone know how to disable a create user button in the Create User Wizard if the Terms and Conditions checkbox is not checked?

I have a CUW with additional fields (the data of which is stored in an additional table that I have added to the ordinaty SQL membership database) and I want the user to check the Terms and Conditions checkbox before the user is created.

By any chance, do you also know how to prevent the creation of the user if the additional fields have not been filled?

I triend with Java, code behind and many method but it still dont work: the user is created even if the Terms and Conditions are not checked.

View 6 Replies

Web Forms :: How To Find A Generic User Control That Checks For Silverlight

Apr 29, 2010

Is there a generic control that can be added to all aspx pages that checks for silverlight plugin and the version.. I know there is javascript and the silverlighthost object tag that accomplishes this. Is there an existing ascx control that wraps this functionality ? I need to be able to set the path to the xap on each page (via a property on the ascx control).

View 2 Replies

Web Forms :: When Any RequiredFieldValidator Validation Fails Display Generic Error Message To User

Aug 9, 2012

I use validation control in my page when users click on button if they don't enter data in textboxs it show massage in validation control

I want In addition to using validation control when users click on button to insert data  it show error massage thar show EX: "please complete your form"

How I can do it ?

View 1 Replies

Security :: How To Create User Button In Create User Wizard

Aug 31, 2010

May i know how i can change postion of Create user button in Create USer Wizard as i want to change according to requirement!

View 4 Replies

Security :: Trying To Create New User With Create User Wizard And Getting Name Already Exists!?

Sep 8, 2010

I am using a create User Wizard for registering a user and have converted it to a a template to capture additional information. In the CreatedUserEvent handler in Code Behind I am getting the UserName of the new user and their unique GUID key. This is then added to a seperate data table with addditional info captured from the user. The textboxes within the create user Wizard have validation controls. If the user has missed an entry these fire and it shops the process of creating the user.

BUT If I then complete the textboxes and then click submit it says the USER NAME already Exists! This is not what I want as the User just needs to correct the errors in the form and they should be able to keep their iniital User Name choice. Do I need to change the Event handler and if so am I still able to capture the USerName and Key so that I can add the data to the other non membership table.

View 2 Replies

What Is The Easiest Generic Way To Save Form Data And Retrieve It When The User Navigates Back To The Page

Feb 17, 2011

What is the easiest way to save form data and retrieve it when the user navigates back to the page?

We have an application process that consists of several web forms. If the user clicks to go back a step we would like to auto-populate the fields. I am assuming there is a common generic way to do this without having to mess with individual controls - what is it?

View 4 Replies

Security :: How To Create User Profile In Multi Step "create User Wizard"

Jun 9, 2010

im creating a multi step create user wizard for new members but I run into a problem. If the create of an account is in step 3 how do I capture the values from step 1 and 2. Should I try to pass the values to sessions or is there some other code. Here is some codebehind I tried so far (did not work).

[Code]....

[Code]....

View 1 Replies

Custom Server Controls :: Using The Generic Type 'System.Collections.Generic.IEnumerable' Requires '1' Type Arguments

Nov 25, 2010

I'm trying to create a control out of a class I found, and one of the overridden functions is the following:

protected override void PerformDataBinding(IEnumerable data)

However, when I try to build the control I'm getting the error as shown in the subject. I've tried searching, and it seems the signature for the original function matches the one I have, and all other solutions I've seen uses the same signature.

View 3 Replies

Difference Between Generic And Non - Generic Collection?

Oct 30, 2010

What is the difference between generic and non-generic collection?

View 1 Replies

C# - How To Create A Generic/parent Type That You Could Send To Methods Without Having To Define An Overload For Each Type

Mar 5, 2011

I'm trying to create a validation layer that will contain methods to validate all my objects (in my Business Objects layer) .. but when I try to reference both the validation and business objects to each other I get a circular dependency error .. so I've decided to create a new layer (BLL) to validate the objects for me and I'll be able to reference both the validation and the object layers.

so I want to build some kind of class/interface -I don't know what fits more- to be like a generic type or a parent type that my method could accept it as a parameter and check for it's Name/ID property. Instead of defining a new method overload for each object type I have
Simplification

View 1 Replies

Data Controls :: Create Generic Function To Bind Multiple Repeater Controls

Aug 4, 2012

According to this thread i bind repearter from database [URL] ... 

Now I have two repeater in my menubar and i want use different storeprocedure for this repeater how i can bin two repeater from database?

<div id="ulmenu">
<ul class="sf-menu">
<li class="current"><a href="#a">FURNITURE</a>
<ul>
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>
<li><a href='#<%#Eval("name") %>'><%#Eval("name") %></a> </li>

[Code] ....

View 1 Replies







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