|
If you are using the the App_Data directory under a Web application then you should be using the |DataDirectory| functionality. Then you don't need to do the Server.MapPath yourself.
On first glance it looks like your SQLEXPRESS instance doesn't have permission to the data directory, the directory doesn't exist, or the file doesn't exist.
But upon closer inspection, you want to remove the setting "User Instance=false" that is going to try to mount the database differently than what you are trying to accomplish. For more information read this.
That being said, having your web app be able to create files, even database files in your sites directories, or even anywhere other than the temp directory is a huge security risk. Consequently, your "CREATE DATABASE" looks to be expected behavior.
One final note:
ASP.NET defines a connectionstring called "LocalSqlServer" in the machine.config, thus it is inherited by all asp.net websites, the default concection string is
data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true
which is nearly identical to your connection string (once the user instance bit is corrected), and the structure of that particular database provides support for all the normal user, password, and permission templates that .NET provides.
|
|
|
|
|
Thank you Alaric. I tried it and it works. Now I would like to switch to SQL SERVER 2005 instead of SQL Server Express. How should I change the connection string?
Thanks,
Hezi
|
|
|
|
|
There are lots of settings in the connectionstring for SQL server, I would visit connectionstrings.com or msdn.microsoft.com to get all the details. But GENERALLY you needs just a handful of settings.
Data Source - this is your server, and instance name, localhost , . , and (local) are all aliases to your local machine. If you are using anything other than the default instance, like SQLExpress, you need to add it after the servername, with a backslash.
User Instance - this is required if you are using SQLExpress and changes how the database is mounted.
AttachDbFilename - is the database file you wish to attach.
Initial Catalog - the name of the database you want to connect to.
So your new connection string, assuming a database name of "cars" on a default instance on your local server using integrated security (so you don't have to store usernames and passwords). It would look like this
Data Source=(local);Initial Catalog=cars; Integrated Security=SSPI;
Notice the AttachDbFilename and User Instance parameters have been removed.
|
|
|
|
|
i want to retain data of previous screen as i move to next. so as onclicking previous button,i have not to reload data
|
|
|
|
|
use javascript on previous button click
javascript:history.go(-1)
|
|
|
|
|
cache your previuos data and when you come back retrieve your data from cache...
Thanks
|
|
|
|
|
Try using the ASP.Net Wizard control first.
|
|
|
|
|
Hi ,
IE showing a warning message when I refresh my page.It says "If you were making a purchase , you should click cancel to avoid a duplicate transaction.Otherwise click retry to display the web page again".How can I avoid this ?
With regards ,
|
|
|
|
|
Buddy, that is something that should have been there right from the start but, folks at Microsoft decided to include it only in IE7.
Its a security feature that says you should not press refresh button to refresh the data. Pressing refresh button repeats the last action, so doing so after doing a transaction like purchase, fund transfer etc would re-submit the transaction and ultimately you will end up with duplicate transaction.
I'm not sure if you can disable it, but even if you can NEVER try to disable it, trust me I know.
HTH!
|
|
|
|
|
Hi,
im using VS 2005 with ajax extension 1.0
i have to pass values in one form to another one form using popup window.
this is all are working fine. but once we can update the values in popup window. is automatically update in parent window(main).
example automatically refresh gridview in main window when i update child window(pop up)..
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
|
|
|
|
|
Use the javascript window.parent property to access the parent window if you are using window.open to open the child window.
You can find tutorials for the same here[^]
HTH!
|
|
|
|
|
Use window.parent.ParentPageJavascriptMethod();
Write ParentPageJavascriptMethod() in your parent page to update tpur parent page content.
Thanks
|
|
|
|
|
Hi ,
Is there anyway to convert an aspx page into pdf ? Please help.
With warm regards
|
|
|
|
|
|
|
I remember answering the very same question just a few days ago.
Anyway, all you need to do is redirect to the details page from the client and not the server. If you do so your search results will be intact when you traverse back via history.back to the search page.
HTH!
|
|
|
|
|
plz, give me more details, How redirect page?
I don't know much about serverside redirection n clientside
Rt now i redirect page using response.redirect
|
|
|
|
|
When you use Response.Redirect from an event handler in the code behind it is called Server redirection. When you use links or window.location from the HTML then it is called Client redirection.
It is not straight forward to change server redirect to client redirect as it might involve a good amount of behavioral changes, but in most cases it would be a simple code change. The crux here is that you would have to generate the redirect URL, the one you use in the Response.Redirect on the server event on the button click, when you generate the search result and make it available as a HTML hyperlink for the user to click and navigate.
Hope I make sense to you.
|
|
|
|
|
|
Dont ever use history.back crap from your web site. Rather always go for an AJAX call, or full postback for your back button.
I always like to disable that back button in the browser. It is very old concept to maintain the history.
|
|
|
|
|
Hello sir,
plz tell me how to use ajax call or full postbox in brief or just forward me link if any
modified on Wednesday, February 3, 2010 3:25 AM
|
|
|
|
|
You can cache your all search page details into a cache and repopulate the search page when you come back from cache...
Thanks
|
|
|
|
|
Thanx
if u can share any example/ more detail then it will more helpful to me, Coz i didn't used cache yet
|
|
|
|
|
hi,
i'm getting problem with session ,while upload excell file and this data import into sql data base ,it works fine untill importing data ,when import finished session state 'null' ,and my session time =20min.could you please find me solution.
|
|
|
|
|
what IOC and why it is require and how it help us. if possible then please discuss the idea in detail.
Thanks in advance
tbhattacharjee
|
|
|
|