I had an exercise where I was supposed to have a button open an openfile dialog box, let the user select a file, then another button that would save the file with the extension ".bak". The author didn't give any clues about manipulating extensions -- but a few chapters back we covered string functions. So, with that in mind, I did the following...
Private Sub btnSaveFile_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveFile.Click
' Where does the extension start
Ive created a simple application that works fine when i debug and test it though visual studio but when i deploy the application, download it and install it onto my machine i get an error.basically when the first form loads it checks for a file called "New Folder" in my program files folder on my machine if the file is not there, then it adds the file. the code im using to do this is:
If System.IO.Directory.Exists(My.Computer.FileSystem.SpecialDirectories.ProgramFiles & "New Folder") Then Exit Sub()
I am just writing a simple file browser. It works without problems when I point to a specific directory but throws "UnauthorizedAccessException access to the path .... is denied" when I point to drive "C:\" or "D:\".
If Not txtToSearch.Text = Nothing Then ListBox1.Items.Clear() FC = 0 For Each foundfile As String In My.Computer.FileSystem.GetFiles("D:\", FileIO.SearchOption.SearchAllSubDirectories, Nothing) Dim title As String = My.Computer.FileSystem.GetFileInfo(foundfile).Name If title.Contains(txtToSearch.Text) Then ListBox1.Items.Add(title) FC += 1 End If Next
I am trying to get a list of files using this line of Dim files() As String = IO.Directory.GetFiles("D:", "*.*", SearchOption.AllDirectories)But it errors out on folders that are inaccessible, like the RecycleBin folder & the program stops. So how do I get a list of files in all folders, while skipping the inaccessible one
If any directory within a set being searched by the [URL] or [URL] methods contains a junction point, the entire method fails and returns zero results on my tests under VB 2008. I would like to make the call more robust: to return the folders or files not blocked by access restrictions and to note the folders which were blocked. Do those methods offer a means to do this, or is a recursive folder-by-folder call necessary?
I am creating a file and then trying to read and write to it. I'm coming up with an UnauthorizedAccessException wa unhandled. My question is, How do I get around this properly or otherwise improperly to read and write to my text file?
Imports Scripting Imports System.IO Imports System.Security Imports System.Security.Permissions Public Class Form1 [Code] .....
I'm trying to write a console application that can modify registry subkeys on remote pc's in the same network. I have it working in my own environment but when I install on the customer machines I'm getting unauthorized access when it hits the OpenRemoteBaseKey. The security settings in the application properties is set to full trust application so I'm not sure why it won't work.
I'm using Visual Studio 2010 and first I just installed it on the customer machine and when it wouldn't work I ran the source code in Visual Studio 2005 which is on the customer machine but got same results.I can run the app directly on the remote machine and it will change the registry subkeys as directed, I just can't do it remotely. RemoteRegistry service is started. Both machines are logged in as administrators.
Here is the source code:
Imports Microsoft.VisualBasic Imports System Imports System.IO Imports System.Security.Permissions
I'm running Windows Vista with admin privilege and UAC is disabled but still unable to write to windows registry! My.Computer.Registry.SetValue _ ("HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionRun", _ "Test", "C:Test.exe", Microsoft.Win32.RegistryValueKind.String)
I'm getting error "Unauthorized Access Exception was unhandled." "Access to the registry key 'HKEY_LOCAL_MACHINE....' is denied."
I've googled the net and found that registry permission elevation is required for admin tasks, Is there away to take registry key ownership through VB.Net code??
I've got a vb (desktop) app (not a web app) that needs to connect to my website, I've been told that embedding my MySQL database credentials is a big mistake for several reasons.So, I've built a web script in PHP that runs on my server called web-service.php, it's located at www.example.com/web-service.php.Now, I'm trying to connect with this code:
Code: Dim hwrRequest As HttpWebRequest = HttpWebRequest.Create("http://www.example.com/web-service.php") hwrRequest.Method = "POST" Using swWriter As New StreamWriter(hwrRequest.GetRequestStream) 'POST the info
[code]....
And when I do, I get the error "The remote server returned an error: {401} Unauthorised.", but I shouldn't need any credentials to access this. I'm just trying to POST a username and password to that page and have it query the database and then get the returned content, I'd prefer to use POST than GET so you can't see the user/pass in the URL (if possible).
EDIT: I used CPanel to password protect my website so it can't be accessed, after supplying my user & pass to access it, everything works.
My application creates a file by writing to System.AppDomain.CurrentDomain.BaseDirectory() & "data/" & filename...Now this works fine usually, but I just added a setup utility to the app, so now it installs to the program files directory. It installs correctly and creates the data folder, however when it tries to write the file it gets an exception "unauthorized access".
I'm using this class to try and impersonate a user on a remote machine.[code]....
However, it fails when trying to open the registry hive with an "Attempted to perform an unauthorized operation" error.I know the password is correct so can someone tell me what might be going wrong?
I'm attempting to login to a cPanel using a POST Request in VB.Net. I have the correct credentials when logging in and when posting I still get an 'Unauthorized (401)' response when it should be '301' (analysed using Tamper Data Firefox Add-On). Below is my post request information and function.[code...]
I am trying to call multiple SQL Reporting Services Reports, get the .pdfs back, then append them together. I have no problems appending .pdfs, but I'm getting an error on the second report. Here's some example code:
I have an application where the admin user can create users and upload documents to the server for the created user to download.
When uploading a file it creates a folder using the userid as the folder name and saves in that folder within a folder called documents e.g. ~documents/77b29079-43d6-4520-bc34-77ae2af1b131/documentname.xls
The client then has to login and will see a list of available documents for that user only. The only problem is that if someone was to get hold of one of the urls to a document is can be downloaded without having to login.
Is there something I can do to stop access to these files?? I have tried editing the web.config file to only allow access to certain roles but i could still download a document without logging in.
I have my own login page.If any user access any page directly(without login),i want to redirect unauthorized user to login page. Using Generic Handler is there any chance?
I have a very long running task I need to take from my website and put into a web service however every time I try call the web service I get this error message The request failed with HTTP status 401: Unauthorized.
I have a program in VB.NET 2005. At some point I have to open an Access2003-Application for getting data in it. I do that by pretending my program is a human user and let it do all the work in Access as a human user would do. Filling Fields, pressing buttons etc. I use the Primary Interop Assemblies for that. So far so good. That code is in use for over half a year now. In the last week I got Office 2007 installed on my machine. Of course I tested the installed version of my program if everthing still works. Every test was succesfull. But if I do the same tests in Visual Studio it always crashes.
All I get is this Errormessage: {"Das COM-Objekt des Typs "Microsoft.Office.Interop.Access.FormClass" kann nicht in den Schnittstellentyp "Microsoft.Office.Interop.Access._Form3" umgewandelt werden. Dieser Vorgang konnte nicht durchgefhrt werden, da der QueryInterface-Aufruf an die COM-Komponente fr die Schnittstelle mit der IID "{66B22FB4-F70E-4F03-A00A-F76E9ADBBF10}" aufgrund des folgenden Fehlers nicht durchgefhrt werden konnte: Schnittstelle nicht untersttzt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE))."}
For all who can't read german:
"Microsoft.Office.Interop.Access.FormClass" can't be converted in to "Microsoft.Office.Interop.Access._Form3" ... Interface is not supported.
Code I use:
Dim access As Microsoft.Office.Interop.Access.Application = Nothing . . . access = New Microsoft.Office.Interop.Access.Application()
[CODE]...
The Error occurs when I try to access any property of "access.Forms("frmTest")"
(using VB2008) I am trying to automate Access from VB.Net. To do this, I added two libraries to my project, Microsoft.Office Interop.Access v12.0.0.0, and dao v10.0.4504.0. This seems to give me all the necessary commands, yet when I tried to open up an Access database via the following code:
This is not a homework of mine and i had never tried ms access database with vb so i just gave it a shot. so this is my first time and i am just trying not asking anyone to complete my homework. I have been searching for this a lot on internet but couldn't find a solution to this so i decided to ask this question here. i have this sql code. what i want to do is that create a basic login form where users puts it's username in the UsernameTextbox and Password in the PasswordTextbox. If the the information match then a message box appears saying that the user is valid and if the information does not exist, a mesage box appears saying the users is not valid. now everytime i execute(run) the code, i come up with this error: Syntax error (missing operator) in query expression ''UserName' = 'Admin' 'PassWord' = 'testing123''.
The field names(UserName, PassWord) are also correct they are same as in the database. the information put in the username and password textbox are correct and they match the information on the database. But i dont know why this error comes up.
My code module is the following:
Imports System.Data.OleDb
Public Class LoginForm1
' Cancel button Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Me.Close() End Sub
this is my code for adding users in my database but it has an error on the INSERT INTO statement.here is the error: Microsoft office access database engine: syntax error in INSERT INTO statement.
vb.net Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Dim conn As New OleDbConnection(cn) Dim check As Integer
It shows up in the services database and when I try and start it I receive a Access denied Error 5 error.I've tried using the local system account to run the serivce and an administrator account. Neither work. I also tried adding the local serivce account and the system acount as owners, also without success
I upgraded from async_sinatra 0.5.0 to 1.0 because the latter fixed this problem So far so good. But when I went back to my original app, (as opposed to my test app), which contained authentication, it stopped working. I am using vb.net to make a webrequest, and this worked fine under 0.5.0, but now fails with "The remote server returned an error: (401) Unauthorized."
I need to guide me to lock my project against "unauthorized use" with a certain registration key which I will send it personally.I also want to inform me if this lock method can break it with reverse engineer method.I use visual basic for my project in visual studio 2010.
I use VB.NET 2010 and an Access DB for little Data-Access. On my developer PC everything works fine.
On the client machine, I get the following error: System.Data.OleDb.OleDbException (0x80040E4D): Keine Fehlermeldung verfügbar, Fehlercode: DB_SEC_E_AUTH_FAILED(0x80040E4D). (No exeption avaiable).
I am using VB .Net to connect to an access databse when using several connection sometimes i get this erro "unspecified error microsoft jet database engine" even though i am an administrator on my local machine.