mdf file is working correctly under App_data folder but after attaching it to sql server give following error when running asp.net page.
Cannot open user default database. Login failed. Login failed for user 'Domain\myUserName'.
[edit] More information; SQL data source and connection string.
<asp:SqlDataSource
id="srcFiles"
ConnectionString="Server=.\SQLExpress;Integrated Security=True;
AttachDbFileName=|DataDirectory|FilesDB.mdf;User Instance=True"
SelectCommand="SELECT Id,FileName FROM Files"
InsertCommand="INSERT Files (FileName,FileBytes) VALUES (@FileName,@FileBytes)"
Runat="server">
<InsertParameters>
<asp:ControlParameter Name="FileName" ControlID="upFile" PropertyName="FileName" />
<asp:ControlParameter Name="FileBytes" ControlID="upFile" PropertyName="FileBytes" />
</InsertParameters>
</asp:SqlDataSource>