Showing posts with label local. Show all posts
Showing posts with label local. Show all posts

Monday, March 26, 2012

Permission & Access problem.

Greetings everyone,

I want to grab some data from a local site hosted on sharepoint services. I tried using the HttpWebRequest & HttpWebResponse classes. Here is the exact code
-----------------------
string lcUrl = "http://xxxxx/";

HttpWebRequest loHttp = (HttpWebRequest) WebRequest.Create(lcUrl);
loHttp.Timeout = 10000;
loHttp.UserAgent = "Code Sample Web Client";
HttpWebResponse loWebResponse = (HttpWebResponse) loHttp.GetResponse();
-----------------------

The problem is I could not open the connection because maybe the site does not allow anonymous access. How do I provide my credentials and open the site and retrieve data.The Credentials property - use a System.Net.NetworkCredential instance containing the details for a user with administrative rights on SharePoint, and also set the PreAuthenticate property to "true"

Saturday, March 24, 2012

Permission Issue

I am trying to test some aspx pages on my local system. The code requires a
"db" directory off the root of the web site. In my Inetpub/myproj I added
the directory but cannot figure out how to give the application authority to
write into that directory. I get the error:

System.UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\OfficeApp\db\judgedata.csv" is denied.

In the error information it says to grant ASP.NET write access to a file,
right-click the file in Explorer, choose "Properties" and select the
Security tab. There is no "Security" tab. I must be missing something here?
How do I set that directory to allow asp.net to write to it?

Wayne"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:uaqU3wViFHA.3568@.TK2MSFTNGP10.phx.gbl...

> Security tab. There is no "Security" tab. I must be missing something
> here?

Uncheck the "Use simple file sharing" (bottom option) in the "View" tab of
the "Folder Options" dialog.

John
Thanks for the suggestion but after doing that I still get the same error?

Wayne

"WJ" <JohnWebbs@.HotMail.Com> wrote in message
news:eTlcryWiFHA.1460@.tk2msftngp13.phx.gbl...
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:uaqU3wViFHA.3568@.TK2MSFTNGP10.phx.gbl...
>> Security tab. There is no "Security" tab. I must be missing something
>> here?
> Uncheck the "Use simple file sharing" (bottom option) in the "View" tab of
> the "Folder Options" dialog.
> John
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:OV5Ov3WiFHA.1148@.TK2MSFTNGP12.phx.gbl...

> Thanks for the suggestion but after doing that I still get the same error?

This only lets you use the "Security" tab on the Windows Explorer. To fix
the error (access denied), you must grant r/w access to the account that
runs your website to the database file where your data resides.

John
John;

Thanks for the clarification. I did that and gave ASP.NET full control of
that directory but it still gives the same error when the code attempts to
create a file in that directory?

Wayne

"WJ" <JohnWebbs@.HotMail.Com> wrote in message
news:Og0ICGXiFHA.3544@.TK2MSFTNGP15.phx.gbl...
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:OV5Ov3WiFHA.1148@.TK2MSFTNGP12.phx.gbl...
>> Thanks for the suggestion but after doing that I still get the same
>> error?
>>
> This only lets you use the "Security" tab on the Windows Explorer. To fix
> the error (access denied), you must grant r/w access to the account that
> runs your website to the database file where your data resides.
> John
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
> John;
> Thanks for the clarification. I did that and gave ASP.NET full control of
> that directory but it still gives the same error when the code attempts to
> create a file in that directory?

Check your local website (IIS/MMC) to find out what account is configured
for the web site, then grant FC to that account. Example: If you allow
"Anonymous" access to the web site, then the User Account box likely shows
"IUSR_YourPCName". Try that see what happens.

John
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
> John;
> Thanks for the clarification. I did that and gave ASP.NET full control of
> that directory but it still gives the same error when the code attempts to
> create a file in that directory?

Check your local website (IIS/MMC) to find out what account is configured
for the web site, then grant FC to that account. Example: If you allow
"Anonymous" access to the web site, then the User Account box likely shows
"IUSR_YourPCName". Try that see what happens.

John
John;

Thanks for the continued help. I am not sure how to determine which account
is configured for the web site (I thought ASP.NET was always used by VSNET
projects?) I went to Control Panel/Administrative Tools/IIS and Properties
but I don't see how to determine the default user for a web site?

Wayne

"WJ" <JohnWebbs@.HotMail.Com> wrote in message
news:eJobGXXiFHA.3936@.TK2MSFTNGP10.phx.gbl...
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
>> John;
>>
>> Thanks for the clarification. I did that and gave ASP.NET full control of
>> that directory but it still gives the same error when the code attempts
>> to create a file in that directory?
>>
> Check your local website (IIS/MMC) to find out what account is configured
> for the web site, then grant FC to that account. Example: If you allow
> "Anonymous" access to the web site, then the User Account box likely shows
> "IUSR_YourPCName". Try that see what happens.
> John
Hi, Wayne.

This all boils down to giving the account ASP.NET is running
under, *whichever account that is* the necessary permissions.

If you have doubts about which account ASP.NET is running under,
just run this short script. It will identify ASP.NET's current identity.

identity.aspx
----
<%@. Page Language="VB" %>
<%@. Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
---

Hope this helps...

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================

"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:uAtm5ffiFHA.3448@.TK2MSFTNGP12.phx.gbl...
> John;
> Thanks for the continued help. I am not sure how to determine which account is
> configured for the web site (I thought ASP.NET was always used by VSNET projects?) I
> went to Control Panel/Administrative Tools/IIS and Properties but I don't see how to
> determine the default user for a web site?
> Wayne
> "WJ" <JohnWebbs@.HotMail.Com> wrote in message
> news:eJobGXXiFHA.3936@.TK2MSFTNGP10.phx.gbl...
>>
>> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
>> news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
>>> John;
>>>
>>> Thanks for the clarification. I did that and gave ASP.NET full control of that
>>> directory but it still gives the same error when the code attempts to create a file in
>>> that directory?
>>>
>>
>> Check your local website (IIS/MMC) to find out what account is configured for the web
>> site, then grant FC to that account. Example: If you allow "Anonymous" access to the
>> web site, then the User Account box likely shows "IUSR_YourPCName". Try that see what
>> happens.
>>
>> John
>>
>>
Juan;

Thanks for that page. That is a handy little tool to have. It revealed that
the account used is "myMachine/ASPNET" (no ".") I gave that FC but it still
gives me the erron on my local machine - it works fine on my real web site.

Wayne

"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:eVXEvCgiFHA.1444@.TK2MSFTNGP10.phx.gbl...
> Hi, Wayne.
> This all boils down to giving the account ASP.NET is running
> under, *whichever account that is* the necessary permissions.
> If you have doubts about which account ASP.NET is running under,
> just run this short script. It will identify ASP.NET's current identity.
> identity.aspx
> ----
> <%@. Page Language="VB" %>
> <%@. Import NameSpace = System.Security.Principal %>
> <script runat="server">
> Sub Page_Load()
> Dim tmp As String = WindowsIdentity.GetCurrent.Name()
> Label1.Text = tmp
> End Sub
> </script>
> <html>
> <head>
> <title>WindowsIdentity.GetCurrent.Name()</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
> </div>
> </form>
> </body>
> </html>
> ---
> Hope this helps...
>
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:uAtm5ffiFHA.3448@.TK2MSFTNGP12.phx.gbl...
>> John;
>>
>> Thanks for the continued help. I am not sure how to determine which
>> account is configured for the web site (I thought ASP.NET was always used
>> by VSNET projects?) I went to Control Panel/Administrative Tools/IIS and
>> Properties but I don't see how to determine the default user for a web
>> site?
>>
>> Wayne
>>
>> "WJ" <JohnWebbs@.HotMail.Com> wrote in message
>> news:eJobGXXiFHA.3936@.TK2MSFTNGP10.phx.gbl...
>>>
>>> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
>>> news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
>>>> John;
>>>>
>>>> Thanks for the clarification. I did that and gave ASP.NET full control
>>>> of that directory but it still gives the same error when the code
>>>> attempts to create a file in that directory?
>>>>
>>>
>>> Check your local website (IIS/MMC) to find out what account is
>>> configured for the web site, then grant FC to that account. Example: If
>>> you allow "Anonymous" access to the web site, then the User Account box
>>> likely shows "IUSR_YourPCName". Try that see what happens.
>>>
>>> John
>>>
>>>
>>
>>

Permission Problem

I'm creating the administration module of the my application. I started by using my local machine as the web server. Currently, the application contains functionality that will: move a file to a server on the network, delete a file from the server on the network, and create a file on the server on the network. All of these functions worked beautifully on my local machine.
Now, I have moved my application from my local machine to the live web server for further testing. All of my functionality, at first, did not work. I would receive "Access denied" messages -- hence, a permission problem. (Keep in mind that there are two separate servers on the network that are used for IO operations in this app)
The network admin and I started at the first logical place -- folder permissions on both of the servers. To make a long story short, we set "Full Control" for "Everyone" on the one directory for server 1. This actually resolved the problem creating, moving, and deleting of files through my app. (Although, not the best solution, obviously) However, when setting the permissions for the other server, (and setting them identical to the first), the application still gets "Access denied" errors.
Can someone throw some suggestions my way, as to what permissions need to be set on these directories to work properly? I'm thrown off by the fact that it worked when my local machine acted as the web server, but not on the live web server. I also confirmed that the IIS settings for both my machine and live web server applications were identical. (Although my machine is running IIS 6, and the live server is 5 I believe)
Thanks!

"Although my machine is running IIS 6, and the live server is 5 I believe" - this probably has something to do with it
IIS 5 uses ASPNET to do work - IIS6 uses Network Authority
check outhttp://asp.net/faq/AspNetAndIIS6.aspx
On the servers - you can edit the Local Security Policy to log failed logons - and then you can see the account being used
Hope that Helps

I apologize...my local machine account is using IIS 5 and the web server is 6. I'll check out that article...


The server that is not allowing me to add/move/delete files does not have .NET installed. Stupid question, but is that what's causing the problem here? Do I need to install .NET and then add an ASPNET group to the directory?

Lots of possible issues here. First is how you're authenticating in the app. If you use anonymous access, the user has changed, and may be a network account if the server is a domain controller. Remember that the accounts on your workstation were likely local accounts and you would need to change the account for your app or duplicate that account on the network.

My guess is you're authenticating users since giving the Everyone group full control fixed the access. They may not need Full Control, and Modify might eb enough on the folders. You may even be authenticating without realizing it since IE will pass authentication credentials if the network is seen as being local or in the intranet security zone. Remove Windows Integrated authentication in your web site if you don't intend to authenticate.

Might try Filemon from Sysinternals.com to check access on specific files. This can help quite a bit on the server to server issues.

Jeff

Permissions Error .. ?

Normally, the data that I work with is on an SQL Server, which is
installed on the web server itself or another local server on the LAN. I
tried connecting to an access database on another server, which I could
fine when designing the page. But, when I ran the page on the web
server, I got this error:

The Microsoft Jet database engine cannot open the file
'\\fileserv\database\transportation\trantrack2003B _testing.mdb'. It is
already opened exclusively by another user, or you need permission to
view its data.

I don't believe I could add permissions to this file for the ASP.NET
account on the web server to access it. How would I go about
'impersonating', as I've heard mentioned before, if this would solve my
problem?I don't believe I could add permissions to this file for the ASP.NET

Quote:

Originally Posted by

account on the web server to access it. How would I go about
'impersonating', as I've heard mentioned before, if this would solve my
problem?


Have a look under the web.config section of:
http://west-wind.com/weblog/posts/2153.aspx
which should help.

Wednesday, March 21, 2012

Permissions on local net

I am creating a local intranet site to use for reporting and other tasks. Some reports should only be accessed by certain people. We are using a Windows 2003 based network. I'd like users to be able to use the site with their same login credentials. (ie if a user logs in to their computer as joe schmoe, I would like them to access the website as joe schmoe without any further login prompts.

Is this possible and/or how do I set this up? I've been playing around with the IIS settings and I cant seem to get it right, it seem to access files and such as the ASPNET user. Is there some setting I should have in the web.config file?

For now, the IIS is version 5.0 because it's ran in a Windows 2000 server...would it be eaiser to move the site to an IIS 6.0 server?If you're using a domain, the recommended way to do this is by using Windows Authentication (in the web.config file you can specify this by means of the <authentication mode="Windows" /> setting). Furthermore, if you want the files on the file system to be access under the context of the logged in user you'll need to enable impersonation (<impersonation enabled="true" />). To get this to work, you webserver should be at least a member server in the domain. However, I'd recommend to move to IIS 6 if you can for better ASP.NET integration and better security/performance.
With this, I get a configuration error:

Parser Error Message: Unrecognized configuration section 'impersonation'
Line 48: <impersonation enabled="true" /
Did you mean:
<identity impersonate="true" />
instead?

I have it set up with <identity impersonate="true" /> and in IIS, Anonymous access is unchecked along with everything else except Integrated Windows authentication.

However, when I attempt to create a file on a network share I get a prompt for a username and password even though the account I'm logged in as has administrator permission and full control over that share. the only way I can continue from this prompt is by enterent the full domain/username and password.

Both the server and client are members of the domain (we're in a single domain environment)

Permissions Problem

I am running Windows XP Home edition with a Cassini server, usingDreamweaver MX 2004. Im just running Cassini as a local server,so I can test my web sites, but I have a problem. When I create adatabase and try to test it, it doesn't work. I get a 403 errorforbidden, I am the only user on my computer and I am administator, soI should have full permissions, but I guess I don't. When I gointo properties under my website folder, there is no security tab, Imguessing because Im the only user. So now Im lost on what to do,any suggestions?
Can you please let me know which database you are using (though I'm guessing you mean Access)? I will then move your message to the relevant database forum.

Yeah, sorry not to include that, Im using access.

I don't think this has anything to do with the database per se. A403 error means the web server is denying access to the page it isbeing requested to serve. I'd check folder permissions.

There are no permissions on my folder, the security tab isnt eventhere. I think its because I am the only user on my computer, soeverything should have full permissions.

Skerb wrote:

There are no permissions on my folder, the security tab isnt even there. I think its because I am the only user on my computer, so everything should have full permissions.

The reason that you do not have the Security tab is that you are using Windows XP Home. In this operating system, Simple File Sharing is always enabled, which means that you will never see the Security tab (at least, according to MSDN).
May I ask that you copy (not move) your .mdb database file into the same folder as your .aspx page. In your .aspx page (or web.config), update the connection string to point to this new version of your Access database. Thismay be a simple solution to your permissions problem.
The web pages, database, and web.config are already in the same folderSad [:(]

Permissions wizard

Hi all
on my local IIS (Windows XP) I can
Website -> Right click -> All Tasks -> Permissions Wizard
And select my settings from the secure web site template.
On my test server Windows Server 2003, I cand find this option. Would anyone
be able to tell me how to install this template or manually set the
permissions the same as a secure web site
thanks in advance
AndyI know when you create a web site in windows server 2003 you can uncheck the
allow unominous access.
Hope that helps you out.
Good Luck
DWS
"AAJ" wrote:

> Hi all
> on my local IIS (Windows XP) I can
> Website -> Right click -> All Tasks -> Permissions Wizard
> And select my settings from the secure web site template.
> On my test server Windows Server 2003, I cand find this option. Would anyo
ne
> be able to tell me how to install this template or manually set the
> permissions the same as a secure web site
> thanks in advance
> Andy
>
>

Permissions wizard

Hi all

on my local IIS (Windows XP) I can

Website -> Right click -> All Tasks -> Permissions Wizard

And select my settings from the secure web site template.

On my test server Windows Server 2003, I cand find this option. Would anyone
be able to tell me how to install this template or manually set the
permissions the same as a secure web site

thanks in advance

AndyI know when you create a web site in windows server 2003 you can uncheck the
allow unominous access.

Hope that helps you out.

Good Luck
DWS

"AAJ" wrote:

> Hi all
> on my local IIS (Windows XP) I can
> Website -> Right click -> All Tasks -> Permissions Wizard
> And select my settings from the secure web site template.
> On my test server Windows Server 2003, I cand find this option. Would anyone
> be able to tell me how to install this template or manually set the
> permissions the same as a secure web site
> thanks in advance
> Andy
>