how to generate a link and send it by mail and when receiver receives this mail and when he first time click on this link then link has downloaded and then this link will automatically expire from the receivers mail?
1. generate a link to a webpage with some query string parameter to uniquely indentify the link. 2. have a DB entry for "fresh/stale" it will be fresh till user has not visited the link, it will become stale once user has visited the link. 3. have a field for link generation time. if the link is not visited for say 6 hours after the generation. it will be considered as stale.
so when use want to generate link
1. create link, put fresh in DB, put current time.
2. when user visit the page check if the (linkstatus = fresh && genrationtime + 6hours < currenttime)
3. if above is true link is valid, perform operation n mark status as stale.
4. if 2 is false then tell the user link has expired
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
In our ASP.Net application we are using Entity Framework 1.0, when I am trying to get data from entity framework, I am getting the following error (The underlying provider failed on Open and in inner exception login failed for user). And I am using SQL server 2008 R2 and Windows Authntication. In some forum, it is suggested to create User Id and Password for the AppPool and then add the same user id and password to the database also then change the connection string. That is not an option for me. My SQL Server is remote for my application from the development itself. I dont have local SQL Server, only client on my machine and Windows authentication is a must for me.
Can anybody please help me in resolving this issue at Entity Framework side or .Net side insteam of changing something in the Database, because its not owned by us.
Important: After I debugged it for a while I found that Database valueis coming as empty stringfor the context's connection string object. Is it expected behavior entity frame work. Please can some body explain me. What would cause entity framework to get database name as empty string? Please help me in resolving this issue. and whats the importance of <dataConfiguration defaultDatabase="LocalSqlServer" />, is the database value picked depending on this? Should I change its value if I just have the client on my machine and SQL Server Database instance is running on the remote server. But still I connect the SQL Server using Windows Authentication. Please somebody help me in resolving this.
And I am getting the following exception also: System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: Login failed for user 'WADS\LNIDPC002580D$'. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) --- End of inner exception stack trace --- at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<t>.GetEnumerator() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at DataAccessLayer.MessageObjectAdaper.GetMessages(Guid messageid) in D:\LNI Applications\Washington Stay at Work\SourceCode\StayatWork-VS2010\DataAccessLayer\MessageObjectAdaper.vb:line 46
Since the application pool user is not on the same domain, windows authentication won't work. How will SQL server know about your app pool user? It does not exist in Active Directory. You need to enable SQL authentication or make your machine join the domain which has the SQL server.
But the same thing is working in Enterprise Library, why only the Entity Framework giving the problems. But I don't have control on the SQL Server completely. Just in case I am asking for the debugging reason, what could be the reason if we SQL Server and my machine is on the same domain. Because when I am logging in to the SQL Server I am logging without using any domain. May be its on the same domain. But Enterprise library is able to connect it without using any domain name.
If I am in the same domain what could cause the entity framework to get the database name in the context objects connection.
res://*/StayAtWorkDataModel.msl;provider=System.Data.SqlClient;provider connection string="
Data Source=LNIDDBTUMSQL24\STAYATWORK;Integrated Security=True;MultipleActiveResultSets=True""providerName="System.Data.EntityClient"/>
The difference between the connection strings is that the ENTLib connection connects to a named instance (LNIDDBTUMSQL24\STAYATWORK) while the EF connection connects to the default instance on LNIDDBTUMSQL24.
I did it, I just copied database on my local machine and tried to connect using the following connection strings. In the place of Datasource value it is coming correct, but in the place of Database its always coming as empty String. Did I do any mistake during the entity frameworks mapping to the database because when I debugged following values are coming while connecting to my local database server also context.Connection.Datasource="(local)\STAYATWORK" or ".\STAYATWORK", context.Connection.Database="".
Something should be wrong. Do I need to change anything in this
Yes I added but its doing the same thing, its showing the database name as empty string, is entity framework having any problem connecting the database using Windows authentication. Thats what I am seeing when googling. Should I switch to SQL Server authentication? For that I need to talk to DBA.
I found whats the problem is, if you can help me in solving it, it would be really great. When I am degging when Entity Framework class "StayAtWorkEntities" is trying to get the data from the SQL Server. There it is throwing exception, because application is trying to access the databse using "<domainname>\<machinename>" account instead of "<domainname>\<My User Name>" account. But this "<domainname>\<machinename>" account, doesnt have access to the Database. Instead I have access to the database.
Now is there any way to force IIS to run these two applications Web Application and a WCF Service under my user account "<domainname>\<My User Name>".
I am also admin on the Server is there any way to force IIS to do that, I have tried by changing the Application Pool Identity to "LocalSystem", "Network Service" in both the cases its running under the same user account "<domainname>\<machinename>" which doesnt have access rights to access the database.