Answered by:
using access db from one app_data folder that is in protected directory

Question
-
User-1688773493 posted
I have a site in one directory and I am creating a customer/partner site that will read the data in another site.
The App_Data folder, that contains the db I need, is in a directory that is user and password protected (web config controls username and password prior to opening any .aspx file in that directory). I need to know how to pass those parameters from customer/partner site so that I can access the db.
Any help is appreciated. Thanks in advance.
Friday, May 6, 2011 10:19 PM
Answers
-
User-1199946673 posted
The App_Data folder, that contains the db I need, is in a directory that is user and password protected (web config controls username and password prior to opening any .aspx file in that directory).The App_Data folder doesn't need to have any forms authentication. ASP.NET will prevent any file to be directly accessed through a browser, it is only accesible by code. This also means that you cannot put any aspx file inside the App_Data folder, it simply doesn't work.
I need to know how to pass those parameters from customer/partner site so that I can access the db.You cannot access an access database directly from a remote site. You need to create a webservice to do that.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 9, 2011 6:55 AM
All replies
-
User3866881 posted
Hi:)
Can you tell me what you mean by saying "is in a directory that is user and password protected (web config controls username and password prior to opening any .aspx file in that directory)"?Are you meaning that you've stored your username as well as password as a pair in the web.config file?
Or something else?
Thx
Sunday, May 8, 2011 9:41 PM -
User-1199946673 posted
The App_Data folder, that contains the db I need, is in a directory that is user and password protected (web config controls username and password prior to opening any .aspx file in that directory).The App_Data folder doesn't need to have any forms authentication. ASP.NET will prevent any file to be directly accessed through a browser, it is only accesible by code. This also means that you cannot put any aspx file inside the App_Data folder, it simply doesn't work.
I need to know how to pass those parameters from customer/partner site so that I can access the db.You cannot access an access database directly from a remote site. You need to create a webservice to do that.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 9, 2011 6:55 AM -
User-1688773493 posted
Sorry for the delayed response. Yes, the username and password is in the web config file
Wednesday, May 11, 2011 4:32 PM -
User3866881 posted
Hi:)
If you save your username and password in the web.config. Maybe you can try this:string connstr = "server=.\;database=xxx;user="+ConfigurationManager.AppSettings["UserName"]+";Password="+ConfigurationManager.AppSettings["Password"]+"integrated security=false;persist security info=true";
and your web.config may look like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="UserName"
value="Your UserName"/>
<add key="Password"
value="Your Password"/>
</appSettings>
</configuration>BTW:Since the web.config is on the server-side. Why not try to write the username and password directly in the connection string? but in the web.donfig?
Thx
Wednesday, May 11, 2011 9:17 PM -
User-1199946673 posted
If you save your username and password in the web.config. Maybe you can try this:Decker, we're talking about an Access database!
And the Username/Password are used for Forms Authentication, not for the database....
Sorry for the delayed response. Yes, the username and password is in the web config file
Did you read my response also?
Thursday, May 12, 2011 4:58 AM -
User3866881 posted
Hi:)
Just like has_v's idea. No need to autheticate in App_Data because you cannot access it directly.And what's more, if you insist authentication for security, maybe you can look at this issue:
http://www.amergerzic.com/post/AccessFormsAuthentication.aspx
Hope this helps
Thursday, May 12, 2011 8:57 PM