ASP.NET "Cannot write to DB File" when logging in - asp.net

please help me fix this.
I am setting up a ASP.NET website using a .mdb (Access) database file. I don't want to use SQL Server because I have to pay more for the hosting.
I followed this guide to get the .mdb file working in Visual Studio: http://imar.spaanjaars.com/404/using-the-microsoft-access-providers-to-replace-the-built-in-sql-server-providers
It all works fine when I run it on my local machine from VS 2008.
I have uploaded my website to my new web hosting and when I try to log in (using the ASP.NET login control) I am getting the message "Cannot write to DB File". It is not a proper error, but just a single line of text.
I have spoken to the web hosting company and they claim that all of the permissions are set up correctly.
I have been fiddling with web.config and so far no success.
Any ideas? Cheers.

Did the Web Hosting company tell you what permissions have been set? You need Modify permissions on the folder that contains the Access database. I say "you", I mean the user account that your application runs under - most likely the App Pool that your site runs in.

Related

Support with hosting an ASP.NET application from my PC at work using IIS Express

I'm fairly new to developing with ASP.NET and in general. I have created a simple data-driven web application that will be used to display images the colors of which will be changed depending on certain criteria. I used Visual Studio 2019 to create it. When I test/run it from within VS 2019 using the "play" button, it runs perfectly and the page opens in my browser just as you would expect.
My issue is that I'm trying to deploy it to the IIS and host it from my machine here at work, so others can access the pages. I have published the application to a local file on my C:\ drive. I then open up IIS Manager and create the website by pointing to that local file. Now, when I choose to browse that site from the IIS manager, at first I was getting an error saying that access is denied.
Then I followed the instructions to configure the security on that local file folder to allow IIS_USRS to access the file, but when I run it, I just get a page that tries to load indefinitely.
What am I doing wrong? If I point the IIS Manager to the files after saving them to a location on my company's network, I again get the access is denied error.
Do I understand it correctly that IIS needs permission to access the files? If so, how do I configure it that way other than what I already tried? If I need to provide further information, please let me know. Thanks so much for your support.

ASP.NET Access to the path denied, on Web Server

I am having a problem, that is when I deployed my asp.net 4.0 application on my web server i am unable to write to App_Data folder. Actually it has an xml file which I am trying to write some information into. I am getting the following error.
Access to the path 'C:\HostingSpaces\hosterind\mydomain.com\wwwroot\App_Data\ErrorLog.xml' is denied.
I tried searching every corner for a possible solution before posting on stackoverflow but i am unable to fix this. Searching similar questions on internet (stackoverflow too) i concluded that i need to handle it through IIS as everywhere it was quoted on internet to grant permission to App_Data folder through IIS Manager. As accessing IIS Manager of your web hosting server is impossible, i supposed people are referring to my local IIS server. So, i copied my project which i was developing in visual studio from location: C:\Users\DanComputer\Documents\Visual Studio 2010\WebSites\MyWebProject and pasted into C:\inetpub\wwwroot. Then i located my project in IIS Manager by selecting DefaultAppPool as application pool. I changed my App_Data folder permission to allow full control for IIS_IUSRS(DanComputer\IISUSRS). Then i copied my App_Data folder to my web hosting space using ftp software but it didn't solve my problem. I tried many thing even changing permission to allow full control for everyone but it did't work and i am still getting the same error. Any help please?
You need to know what is the identity of the Application Pool of your app. You can get this information from IIS or console. It is possible that your hosing company may have a control panel that can give you that information.
Then you need to give permissions to the account in the app pool identity the names will be the same or at least be very similar to what you saw in IIS:
So using my examples above I will have to give permissions to Local Service or Network Service to read/write my app_data folder.

IIS7 IUSR account permissions not working with forms authentication and file upload

I am trying to deploy an asp.net 4 app to a new microsoft server 2008 R2
I have set up the application as I have done dozens of times before and set the folder permissions appropriately.
I have tried setting the application pool name directly to have write permissions
I have tried setting IUSR, IIS_IUSRS, NETWORK SERVICE and Users.
I have confirmed that windows authentication is disabled and anonymous is enabled as well as forms authentication is enabled. Logging in works fine i can access all pages normally except if i try to write to the folder. Then a password is required box pops up which looks like windows authentication (even though its disabled)
Every post here states and in my past experience says if I set the folder permissions for the defaultidentity application pool it should work, but for some reason this server wont let me do it!
Any help would be most appreciated.
Welp this turns out to be a really weird one. For some reason when SQL reporting services is installed it reserves the folder name "Reports" in any IIS Web application folder regardless of whether your actually using Reporting services. Its not created by default or anything, but if you happen to create folder titled "Reports" dont expect to access anything from it. After many hours of frustration it turns out it's a random reservation which doesn't throw any error just somehow overrides your authentication protocol to use windows authentication for their reserved folder.
Thanks Microsoft!

deploying from sql server express to datacenter

I'm taking the database that I created with SQL server express and putting it on a server in a datacenter. There are 2 database files in AppData folder: the aspnetdb.mdf file and the file I created for my site MySite.mdf. I'm using the ASP login control and that works with the ASPNETDB.mdf file and it's working. If I log in without the correct username/pwd, it'll display a bad login message.
However, as soon as I login and the site goes to make a request to MySite.mdf, I get an error "Invalid object name 'dbo.Users'." which is the name of the first table the site looks into after the login.
I've attached the MySite.mdf file to the server and copied the connection string the hosting company is generating into the web.config file and left the rest as is.
Could it be that I can't attach a sql express file?
Please let me know if you've run into this issue or if you have any suggestions.
Thanks.
Based on your description and the following assumptions:
your authentication still works
you haven't mentioned attaching your aspnet.mdf
you have separate databases for security and datastore
you're probably still testing locally
I'd guess that your application is still pointing at your local aspnet database - that's why authentication still works. Typically in a shared host, you'll have to install/insert the asp.net security database items to your main database. See This MSDN page for instructions on setting up the asp.net database objects.
You need to establish whether or not you've actually attached your database or not. Is there an online "database manager" you can access? Or can you connect to your database from SSMS or your dev environment and run a simple query?

What user does classic asp run as?

I have an asp page that saves a file to disk.
Currently it works locally, but I need to save the file to a share and I get permission denied.
I had assumed I could just set the app pool to the user that has access to the folder, but it doesn't seem to work.
How do you make classic asp run as a specific user?
I believe that by default classic asp will run under the iis user which is IUSR_MachineName. This can be changed in the IIS Manager.
Good references:
http://kb2.adobe.com/cps/153/tn_15378.html
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=287
IIS Admin - Website Properties - Directory Security - Edit...
By default it's IUSR_MACHINENAME
Look at who is running the following:
"inetinfo.exe" process
"World Wide Web Publishing service"
It should be one of those I believe.
Is the program attempting to go to a share on another computer (or this computer), or a folder on the web server which happens to also be a share? When you access it through the \\server\share notation, you are going to have different issues than through the local drive driveletter:\folder\ notation.
If it is a share on another computer, the account will need to have rights to the share as well as rights to the underlying files and must be a domain account.
It depends on what you are actually doing but you would probably want to avoid giving the whole application a user identity that has network access just to service the needs of this one file.
You can configure in IIS the user identity for anonymous access on that one ASP file, that would be better than setting it for the whole application.
Another option in the intranet environment is to turn off anonymous access for the ASP file and turn on windows integrated access. The clients user account is used for the security context for running the ASP and any subsequent network access it might make.
I've encountered a similar problem : Unable to Execute Bat EXE or CMD.exe from classic ASP pages on IIS 7.
As I have found a solution, I HOPE it will help the folks to save time !
For a solution look there : (I've Marked the very last post as Answer).
http://forums.iis.net/t/1193937.aspx/1?+BAT+and+vbs+Files+does+not+run+anymore+from+Classic+ASP+was+running+on+Win+2003+Server+
Have a great starting 2013 !

Resources