Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7623957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:50:14+00:00 2026-05-31T04:50:14+00:00

One of the client requirements is that the server generate files and store them

  • 0

One of the client requirements is that the server generate files and store them on a special folder. This files created can not be modified by users or deleted.
So the only way I thought is to generate this files with elevated privileges so a normal user can’t delete or modify them.
But the question is how can I generate a file with this privileges that normal users can interact with this files… only download from server.

I use this code to generate the file… But I don’t know how to configure it for elevated privileges.

This is the button which generate the file and allow to download it:

Protected Sub ibtGenerar_OnClick(ByVal sender As Object, ByVal e As ImageClickEventArgs)
    oArchivoTelecredito.NombreArchivo = txtNombreArchivo.Text
    oArchivoTelecredito.SesionDetalleArchivosTelecredito = New List(Of DetalleArchivoTelecreditoBE)
    Dim oArchivoTelecreditoSL As New ArchivoTelecreditoSL
    Response.AddHeader("Content-disposition", "attachment;filename=" & oArchivoTelecredito.NombreArchivo & ".txt")
    Response.ContentType = "application/octet-stream"
    Response.BinaryWrite(oArchivoTelecreditoSL.GeneraArchivoTelecredito(oArchivoTelecredito, Server.MapPath(oArchivoTelecredito.NombreArchivo)))
    Response.End()
End Sub

This is the function which create the file on server:

Public Function GeneraArchivoTelecredito(ByVal telecredito As ArchivoTelecreditoBE, ByVal ruta As String) As Byte()
            Dim lineas As Integer = telecredito.SesionDetalleArchivosTelecredito.Count + 1
            Dim registro(0 To lineas) As String
            registro(0) = Me.ObtenerCabeceraArchivoTelecredito(telecredito)
            Dim archivo = ruta & ".txt"
            Using escritor As New StreamWriter(archivo)
                For index = 0 To lineas
                    escritor.WriteLine(registro(index))
                Next
                escritor.Close()
            End Using
            Dim lector As FileStream
            lector = File.Open(archivo, FileMode.Open)
            Dim bytes(lector.Length) As Byte
            lector.Read(bytes, 0, lector.Length)
            lector.Close()
            Return bytes
        End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:50:16+00:00Added an answer on May 31, 2026 at 4:50 am

    If you want to set the file to be read-only then you can use

    File.SetAttributes("PathToFile", FileAttributes.ReadOnly).
    

    You could also set the permissions on the directory itself instead of the individual files – see this post: https://serverfault.com/questions/3878/is-there-a-way-to-prevent-a-file-from-being-deleted

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a server in C# which can accept only one client and I
My client gave me very diffrent requirement yesterday. I have one folder at server
I'm using VisualSVN client and server and one of the requirements for web projects
How does one go about properly analyzing the requirements of a client in terms
We're developing a Search Reporting feature for a client. One of the requirements is
I have made some changes in one perforce client, but haven't submitted them. I
Say I have a simple client/server scenario with one method: // client code $client
One of the requirements for the application that I'm working on is to enable
I'm designing a custom client server tcp/ip app. The networking requirements for the app
We are developing an application that has an iPhone client, and a Rails server.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.