.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Using , want to restrict access to file .wmv

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net

Hi all,  I want to secure a particular set of files in a folder by role type.  I have the following entry (See below)...I notice this doesn't work (I.e., it doesn't secure the file by Role Type..anyone can access the file).  I've read that I need to map the .WMV extension to the ASp.Net DLL.  Can somebody give me some details on how to do that?  (I'm a newbie).


Thanks in advance.


<location path="media/mymediafile.wmv">
        <allow roles="MediaRole" />
        <deny users="*" />



View Complete Post

More Related Resource Links

Access to path xxx denied when uploading a file using c#

Hi I have a file upload app written in c#. The app runs on IIS on a Windows 2003 Server OS. I want the app to upload the file onto the server (The app and the server are on the same machine). This code has been working fine for a long time running on Windows Server 2000, and Windows XP Professional. Now when I moved onto Windows Server 2003, it stopped working. I have given ASPNET account full access to the folder on the server, and it still gives this error. Is this a bug in 2003, and can anybody assist me? Thanks Shane

Tring to write to web.config file error Access to the path


Hi Friends.

Actually i m trying to make a setupfile for my project.That makes some processes and at the end of processes will change web.config Database connectionstring values and will run project.Evertthing is good but cant reach to web.config file beacuse of permissions.
Project will run on out of company hosting account.So i cant reach IIS to change permissions.

So please offer me a way or if you know solution.Please help.
I also thinking on downloading web.config file with ftp account and change it and reupload back with programaticly in code.
Waht you think???

System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Access to the path 'C:\Inetpub\vhosts\xxx.com\httpdocs\rouqudck.tmp' is denied. (C:\Inetpub\vhosts\xxx.com\httpdocs\web.config) ---> System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\vhosts\xxx.com\httpdocs\rouqudck.tmp' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, B

.OCX reference issue "Path/File Access Error"


Hi All,

hopefully someone has solution of this error.

i am adding reference on a .ocx file in my project.

When i tried to access the method of this file .

I get the following message "Path/File Access Error"

I tried running the following commands 'regsvr32 XYZ.ocx'.

but issue is same.

Thanks in advance

Access to report file denied. Another program may be using it.


Migrated from Windows 2000 ASP.NET 1.1 to Windows 2003, ASP.NET 2.0 and had this error. All the forums/MSDN/Blogs says to give Read/Write Access to C:\Windows\Temp folder. Why should we give Full Access to some folder in Production server?? In windows 2000, ASP.NET 2.0 development machine, no files are created when we run crystal reports from aspx pages. Then why in Windows 2003 servers, we need to give rights to temp folder?? It is a simple code


And the code is not storing anything on the disk. Then why should it store the GUID.rpt file in Temp file in Windows 2003 server?? Any alternative is there not to store anything on the disk when Crystal Reports are opened in aspx page??


Access Control: Understanding Windows File And Registry Permissions


Understanding the ACLs that govern permissions and rights before an operation is allowed to proceed is critical to enhancing security.

John R. Michener

MSDN Magazine November 2008

File Attachments from info-path forms to Sharepoint document library


Hi Experts,

How to upload file attachements from info-path forms to Sharepoint document library?

I need to add attachement from local-PC/Any User to Sharepoint Document Library.


Any help please?? Appreciated




Asp.Net upload file access denied



I have the problem below, if anyone can help me, appreciate it.

Server Error in '/' Application.

Access to the path 'c:\Inetpub\EnewsAttFiles\employ-e-header2.jpg' is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'c:\Inetpub\EnewsAttFiles\employ-e-header2.jpg' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Hig

How do I find the file path from a namespace.class name?


I'm programatically looking ito a .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx I read in its Page Directive and found its CodeBehind equals "myApplication\myPage.aspx.vb". Then I use the code below:


Dim Assm As System.Reflection.Assembly = System.Reflection.Assembly.LoadFrom("myApplication\bin\myApplication.dll")
Dim ClassType As Type = Assm.GetType("myApplication\myPage.aspx.vb")
' myBaseType = "myApplication.Forms.BasePage"
Dim myBaseType As System.Type = ClassType.BaseType


Now I want to read the BaseFile (class = myApplication.Forms.BasePage). However, to read in this file, I need I need to get its full path instead of its namespace.class hiearchy. In this case, the BasePage is wrapped in a different namespace declaration thus I cannot just change the '.' to '\' in order to get the path.

How can I get the path of BasePage so I can read it? Thank you - Frank

HTTP verb POST used to access path ' ' is not allowed



Im new to ASP.NET MVC 2.

Im trying to call a controller method using Jquery $.ajax().

---- inside Controllers/ServiceController

public string GetString()


        return "My First MVC Ajax Testing";


---- javascript code calling the controller method

    var serviceUrl = '~/Controllers/ServiceController/GetString';

    var jsonData = '';


        url: serviceUrl,

        type: 'POST',

        data: JSON.stringify(jsonData),

        dataType: 'json',

        beforeSend: function (XMLHttpRequest) {



        success: function (data, textStatus, XMLHttpRequest) {

            onSuccess(data, textStatus, XMLHttpRequest);


        error: function (XMLHttpRequest, textStatus) {


How to restrict folder access to users and theirs only


Hi. I created a web application using "Forms Authentication". 

There is a folder name "uploads", and it creates subfolders as username when they register. Web application stores users' files and images under their folder ("uploads/username")

I tried to find a way to restrict users to download and upload files to their folder only and couldn't find a good one. 

Then I came up with this idea that stores "web.config" file each time user registers and the web.config should look like below. Username will be changed dynamically according to username.

This method actually works but I am little worried if this is a good practice as far as performance wise. Because it'll create web.config files as many as users and there might be other holes that I don't recognize. 

I appreciate any advice or better suggestion for this problem.

--------web.config in "/Root/uploads/username directory"--------------

<location path="HRpages">

Access resource file using webservice


Hi I need to access a resource file in a web application, using a WCF web service.

The webservice will be hosted in the same domain as the web application, but its business logic is in another assembly.

How can I retrieve the correct resouce file (according to the current culture) from the business layer, and returning a List of KeyValue pair from it?

Thank you.

Error "The process cannot access the file ....." occurs while using function "ExportToStream"


Dear all,

   I sometimes get the following error while printing crystal report to pdf:

   System.Runtime.InteropServices.COMException (0x80004005): The process cannot access the file because
it is being used by another process. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export
(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream
(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
 at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at
 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at
 CommonWA.CommonFunc.GetPDFMemoryStream(DCMSReportDoc _dcmsreportdoc, Boolean& _DataExist) in E:\wwwroot\ASPWA\CommonWA\CommonCom.vb:line 382

  The error not occurs frequently but sometimes it will happen, can someone tell me why the error occurs and how can I solve the problem?

Thank you very much.


Acces the file upload path

how can i acces the file upload text. I mean if i choose a file , then the file path comes in file upload e.g. c:/data/fil1.txt.All i want to acces this full path and show in a label.

Who to restrict access to only one view.

What is the best way to grant access for a user, to select from only one view, not the actual tables?

Resource File Access

Hi, I have not yet used resource file for storing the common messages throught the application and access it whenever required. Can any one help me on this?    

How to set anonymous access to IIS 7 from web config file im using asp.net 2.0 C#

HiI have developed asp.net 2.0 website with crystal report now what my problem is whenever i go to crystal report page its by default going to login.aspx or default.aspx though i didt set any login to my asp.net page..I talk with my hosting provider they said that the asp.net impersonate is enable..I think in IIS 7 authentication if i set anonymous access enable, will it work fine?so i need to know how to enable anonymous access from my webconfig ..so please let me know how to do?

Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not

Hi,I am looking for a Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not. To know it currently I am using "Directory.GetFileSystemEntries(Path).Count" and checking if count > 0 then returning True else False. For this first method calculates all the files and folder and then return status to me but I want to exit out as soon as my method gets first element(file/folder) in specified path. Because above method is timing out when my input path contains more than 1 million files. I just need to check whether input folder path contains any child file/folder or not. I have tried to use Win32 API also but on ther server it is crashing so I donot want to use that solution. In .NET any method or way is present to know it. Please suggest me.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend