Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems Creating a file
Message
From
14/01/2011 08:35:30
 
 
To
14/01/2011 08:18:10
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01496043
Message ID:
01496153
Views:
21
>>>>>>TBH I'm not au fait with all of the CredentialCache stuff. If I were you I'd try creating your own credentials and using that:
>>>>>>Req.Credentials = new NetworkCredential("UserName", "password"); // or other relevant constructor
>>>>>
>>>>>So create a user on the server with the necessary rights, then set the code to use this user? I don't particularly like that idea for the following reasons: I then need to hard code the password in, I need to work out what rights to assign to the user on the server. If somebody then changes the password on the server I have to recompile my code. Or am I misunderstanding what you suggested?
>>>>
>>>>So the web server at the oAppSettings.ReportServerURL address is under your control? So what is it currently expecting/accepting as a valid authentication/authorisation ?
>>>
>>>The web server is SQL Server Reporting Services and looking in the configuration manager it says the Service Account is "Network Service".
>>>
>>>I had a look at the event log and it sems the DefaultAppPool account is the one that my system is trying to use. Here's the detail of the log:
>>>
>>>Event code: 3005
>>>Event message: An unhandled exception has occurred.
>>>Event time: 01/14/2011 8:00:45 AM
>>>Event time (UTC): 01/14/2011 12:00:45 PM
>>>Event ID: fd216790eada4779be60461c14263d75
>>>Event sequence: 14
>>>Event occurrence: 1
>>>Event detail code: 0
>>>Application information:
>>>Application domain: /LM/W3SVC/1/ROOT/SIAS-1-129394800055232727
>>>Trust level: Full
>>>Application Virtual Path: /SIAS
>>>Application Path: C:\SIAS\
>>>Machine name: NEWIMIASDB
>>>Process information:
>>>Process ID: 4316
>>>Process name: w3wp.exe
>>>Account name: IIS APPPOOL\DefaultAppPool
>>>Exception information:
>>>Exception type: WebException
>>>Exception message: The remote server returned an error: (403) Forbidden.
>>>Request information:
>>>Request URL: http://localhost/SIAS/ReceiptEdit.aspx
>>>Request path: /SIAS/ReceiptEdit.aspx
>>>User host address: ::1
>>>User:
>>>Is authenticated: False
>>>Authentication Type:
>>>Thread account name: IIS APPPOOL\DefaultAppPool
>>>Thread information:
>>>Thread ID: 5
>>>Thread account name: IIS APPPOOL\DefaultAppPool
>>>Is impersonating: False
>>>Stack trace: at System.Net.HttpWebRequest.GetResponse()
>>>at SamaanSystems.IAS.Web.ReceiptEdit.btnSave_Click(Object sender, EventArgs e) in C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Web\ReceiptEdit.aspx.cs:line 420
>>>at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
>>>at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
>>>at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
>>>at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
>>>Custom event details:
>>>
>>>Maybe that makes any sense to you?
>>>
>>>I've tried adding DefaultAppPool to have access to the Temporary Internet Files folder, but it tells me that user name is wrong.
>>
>>You need to look in the DefaultAppPool properties (Identity tab) to determine what account was being used (chances are that unless you changed it then it will be 'Network Service'.
>>
>
>I'm afraid I've never really had to dig into this kind of thing before. Could you tell me where I can find this Identity tab you refer to? In IIS Manager under Application Pools (this is on Win Server 2008 R2) I see DefaultAppPool. If I go to Advanced Settings I see the Identity is ApplicationPoolIdentity (no, I've never even seen this screen before so I didn't knowingly change it). I've tried changing that to Network Service, but had the same error excpet that it refereed to the NETWORK SERVICE user instead of DefaultAppPool.

Haven't got access to that IIS version here so can't compare (on the version to hand I right-click on the relevant pool and select Properties)....


>>But I think we're a bit at cross-purposes here.
>>Is anonymous access enabled for the URL on the report server used by the HttpRequest?
>
> How do I check that?
You just did :-} - by attempting to access via a browser. Since it asked for a login then anonymous access is disabled.


>>If it is then all you need be sure of is that the IIS account used by that page on the report server (as determined above) has sufficient permissions/rights to access the required folders on that server.
>>If the page is NOT allowing anonymous access then your HttpRequest much include credentials that will be recognized as valid by the report server. This won't change the account used to process the page on the report server.
>>What happens if you try accessing the url from a browser? Are you prompted for login information?
>
>Yes, I get prompted for the Administrator password, but just the first time.
Once you've logged in once it will persist until the browser is closed.....

I'd suggest temporarily allowing anonymous access the the url you are trying to reach with the HttpRequest. That way the credentials you send (if any) are irrelevant.
If the process still fails then the problem will be internal to the report server - you'll still need to determine the IIS account being used to process the request and make sure it has sufficient access permissions.
If it succeeds then remove the anonymous access and try hard coding the administrators credentials as the HttpRequest.Credentials.
(JIC : You can change the anonymous access setting by opening the page properties / File Security / Authentication /Edit and toggling the check box)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform