.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Identity Seed value reset mysteriously

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :

Hi all,

I have a puzzling issue at this time. My environment is (result from @@version)

Microsoft SQL Server 2005 - 9.00.4230.00 (X64)

Jul 30 2009 13:42:21

Copyright (c) 1988-2005 Microsoft Corporation

Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

I have four physical servers with transactional replication setup among the servers, one is a dedicated distributor, another is a publisher, and two are subscribers.

For the replication setup, here are more details (simplified but sufficent to describe my issue)

I have two publications (I'll call Pub_A and Pub_B), both are transactional replication with updatable subscriptions. Each publication has several articles, of course each article is different from each other, but each article has an identiy column as primary key. We set up the replication in such a way that we manually control the identity range, i.e.  sp_addarticle @identityrangemanagementoption='manual', xxxx (other parameters). With this said, on subscriber one (SubServer_1), we have a subscription table called SubTable_A, whose identity column A_ID is assigned a range of 1000 to 1999, and the same table SubTable_A on subscriber two (SubServer_2) is assigned a range of 2000 to 2999 for A_ID column. Since these are updatble subscriptions, it means for SubTable_A on SubServer_1

View Complete Post

More Related Resource Links

T-SQL how set identity seed on auto increment +1


hi everybody

I have stored procedure where i am creating table and setting primary key how to set auto increment ?

set @sql =@sql + 'CONSTRAINT [PK_'+@Table+'] PRIMARY KEY CLUSTERED ([ID] ASC)) ON [PRIMARY]'

Thanks for any idea

MSSQL Transactional Replication (Identity Seed)



Im doing a migration from server A to server B.

I used transactional replication. Everything replicated nicely, however, the primary key constraint. Identity had auto resetted to 1. (which is not correct).

The table was created as "NOT FOR REPLICATION" <-- is this the main cause? I cant do anything to the database, as i'm not the application owner.


    [abrev] [varchar](50) NOT NULL,
    [converted] [varchar](50) NOT NULL,
    [longtext] [varchar](50) NULL,
    [texttype] [varchar](50) NOT NULL,
    [abrev_id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
    [abrev_id] ASC

now, how do i save the situation? should i mirror the table structure, then do a replication for data?

please advise.

thanks Shawn

Pass ASP.NET membership identity object across domain?


I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

If this is possible, I am going to implement this solution. Please tell me what's your take on this.

Federated Identity: Passive Authentication for ASP.NET with WIF


The goal of federated security is to provide a mechanism for establishing trust relationships between domains. Platform tools like Windows Identity Foundation (WIF) make it much easier to support this type of identity federation. We show you how.

Michele Leroux Bustamante

MSDN Magazine August 2010

AD FS 2.0 in Identity Solutions: Using Active Directory Federation Services 2.0 in Identity Solution


This article explains how you can use Active Directory Federation Services (AD FS) 2.0 to claims-enable Windows Communication Foundation (WCF) services and browser-based applications. The focus is on the token issuance functionality in AD FS 2.0. You'll find out how to use AD FS 2.0 as an identity provider; set up an AD FS 2.0 security token service (STS) to interact with WCF; federate AD FS 2.0 with your custom STS or another AD FS 2.0; enable Web single sign-on and federation with WS-Federation and SAML 2.0 protocols; and externalize authentication logic through Visual Studio. You'll come away appreciating how AD FS 2.0 and Windows Identity Foundation make programming identity solutions in Windows less of a chore.

Zulfiqar Ahmed

MSDN Magazine November 2009

Security Briefs: Exploring Claims-Based Identity


Keith Brown introduces you to the new identity model in the Microsoft .NET Framework 3.0.

Keith Brown

MSDN Magazine September 2007

Identity: Secure Your ASP.NET Apps And WCF Services With Windows CardSpace


Windows CardSpace replaces traditional authentication with a more consistent and streamlined login process and improves trust between end-users, applications and services. Michèle Leroux Bustamante explains.

Michele Leroux Bustamante

MSDN Magazine April 2007

What is the easiest way to reset all the values of controls on a web form (vb.net) to their defaults


What is the easiest way to reset all the controls on a web form.  Can I set "veiw state" to false for all of the controls with one command, do a response-redirect to its own page, and set view state back to true.  What is the easiest way to do it.



Required columns on list; how can I reset them to be NOT required?

I have a user list where several fields in a sharepoint list that were originally created as required, but would now like to make them not required. I have already tried simply unchecking the required field checkbox, but that does not work. Any other ways to do this?

Aajaxtoolkit control +

dear all,   i have propblem, when i put  <identity impersonate="true" userName="domain\username" password="password" />   i have the following erro: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.   but if i remove this tag : <identity impersonate="true" userName="domain\username" password="password" /> this site work normally. and i need to put this tag in web.config.

Windows Identity Foundation Security Token Service can't stay logged in

I'm using the Windows Identity Foundation **(WIF)** Security Token Service **(STS)** to handle authentication for my application which is working all well and good. However I can't seem to get any long running login with the STS. From my understanding I shouldn't care about the client tokens at the application level since they can expire all they want to and it should redirect me to the STS and as long as they're still logged in on the STS it should refresh their application token. Yet it doesn't seem to want to keep them signed in. Here's what occurs in my login.aspx on the STS var cookie = FormsAuthentication.GetAuthCookie(userName, persistTicket); if (persistTicket) cookie.Expires = DateTime.Now.AddDays(14); Response.Cookies.Add(cookie); var returnUrl = Request.QueryString["ReturnUrl"]; Response.Redirect(returnUrl ?? "default.aspx"); Which was taken almost directly from existing application using normal Forms Auth. From my web.config <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" timeout="2880" name=".STS" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </auth

Replication and auto Identity Increment

We want to have two SQL server working on the same data at the same time (SQL Server 2008). I've been told that the auto ID's will stop working (the identity option). I'm not sure how true this is or what is the best replication to use for this.   Thanks

Fetch Identity column just after inserting a row in table

Hi, Please help me with this question. I have a table and I insert a row into it. How can i select the latest inserted row? Can the 'inserted table' keyword be used outside trigger? ( I mean can we use it in above scenario?? If yes how)   Thanks in advance Tiya

MessageSecurityException "Identity check failed for outgoing message" when using custom endpointaddr

Hi! I am currently developing a WCF service which will use ASP.NET Membership and RoleProvider as authentication/authorization. I followed the description in on this page http://msdn.microsoft.com/en-us/library/ff647294.aspx to do this, and everything works as expected when I try add a reference to my development service and uses that without any interaction. But, I want to be able to override the enpoint address in code since the server may be placed on other servers, but when I do this in my code (with the same enpointAddress stated in the client wcf file for testing purpose) I get a MessageSecurityException with this information: "Identity check failed for outgoing message. The expected DNS identity of the remote endpoint was 'localhost' but the remote endpoint provided DNS claim 'MyCert'. If this is a legitimate remote endpoint, you can fix the problem by explicitly specifying DNS identity 'MyCert' as the Identity property of EndpointAddress when creating channel proxy." I have search the net for information about this, and found that the only thing I had to do was to add a <dns value="MyCert" /> to my client wcf configuration, and everything should work. But it doesn't, I still get the same error. My server behavior configuration looks like this: <serviceCredentials> <serviceCertificate findValue="CN=MyCert" />

Why does MVC2 reset my Context.User but MVC1 doesn't?

The question comes from a previous thread, but I would like to ask a more specific question from anyone in the know.Why does MVC2 reset my Context.User, discarding changes made in Application_AuthenticateRequest but MVC1 does not?Repro is pretty simple:Start an MVC1 and MVC2 new project. In both of them add the following code in global.asax: protected void Application_AuthenticateRequest(Object sender, EventArgs e) { if (Context.Request.IsAuthenticated) { FormsIdentity ident = (FormsIdentity)Context.User.Identity; Context.User = new System.Security.Principal.GenericPrincipal(ident, new[] { "FooAdmin" }); bool result = User.IsInRole("FooAdmin"); } } // break hereNow in both HomeController.cs files change the Index Action to: public ActionResult Index() { bool result = User.IsInRole("FooAdmin"); ViewData["Message"] = ""; // break here return View(); }Deploy to IIS, attach debugger on the "// break here" lines and then login to each site in turn.You should find that under MVC1 the result variable at both breakpoints is true, but in MVC2 it is false in the Index action.Anybody have any idea why? Is this a bug or by design? Any way around it?

scope identity...

 I need to get the identity (scope_identity) value of the newly inserted record. I don't see a way to do this.    I'm using public static int Insert(string planName, string planDescription, int offerID, int userID) { using (OLTPEntities context = new OLTPEntities()) { context.plan.AddObject(new plan() { plan_name = planName, plan_description = planDescription, offer_id = offerID, create_date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), last_update_date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), last_updated_by = userID }); return context.SaveChanges(); } }  

Combining databases with Identity columns

(Using SQL Server 2005)  I have only a basic knowledge of SQL Server, but need to roll up 5 SQL databases into one database (I guess this is known as "replication"?).  These database are of similar structure and make use of an identity (or autonumber) column.  These id's are also referenced in numerous child tables.  To avoid collisions, this is my plan:   1.  turn off the identity feature of all the columns (but still keep condition of uniqueness) 2.  For each database, assign a unique range of identities (ie, db1 gets 1-500, db2 gets 501-1000, etc) and then renumber these columns accordingly.  The new id's should cascade to the child tables via the table relationships. 3.  Replicate or copy the data of all 5 databases into the new one.  There should be no collisions. 4.  Turn back on the identity feature of the appropriate columns, hopefully everything works as before. After this is done we hopefully can get rid of the 5 original databases and proceed with just one. Should this work and/or is there a better way to do this?  
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend