Ruby - Sinatra Async 1.0 Returns "unauthorized" While 0.5.0 Does Not
May 2, 2012
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."
[Code]...
View 1 Replies
ADVERTISEMENT
Sep 6, 2011
I am trying to use VB.Net to upload a file to a Sinatra web service, and I'm not sure how to configure either end. When I run the VB.Net app, sinatra invariably responds with code 404. Here's the VB.Net code, which I converted from another SO post:[code]which does show "got here", but is obviously useless because I need to deal with the file.
View 1 Replies
Jun 3, 2010
I'm trying to write a 'developer friendly' wrapper for the Windows API EnumWindows - the problem is that the API uses a callback function that gets invoked on another thread, where as I want my wrapper function to simplify this and make it more useful by working like any other normal synchronous function and just returning a value.
Now if the API just called the callback once that would be fine, as I would just call the API and make the wrapper function wait until it got a signal from the callback function telling it to continue... but the API calls the callback function over 100 times (once for every window handle that exists). The biggest problem is that there is nothing that indicates that any particular call to this callback function is the last one, so my wrapper function has no idea when it is safe to continue and return the list of window handles to the caller.
The only solution I could think of is to do this:
1. The wrapper function calls the API and starts a timer that waits 2 seconds before it raises the Elapsed event. The wrapper function then pauses until it receives a signal (ManualResetEvent)
2. Each time the callback function is raised by the API on a different thread, it stops the timer (so this is before the 2 seconds have elapsed), adds the current window handle that was passed in by the API to the list of handles, then starts the timer again.
3. If the timer reaches its 2 second interval then it is assumed that we are at the end of the windows because otherwise the callback would have stopped the timer. So the timer's Elapsed event handler is what signals the original thread (that the wrapper function is executing on) to continue as we now have a complete list of windows to return.
This works fine and does exactly what I want... but I dont like it.
I dont like forcing the caller to wait an extra 2 seconds after the API has done its last callback but more importantly I dont like assuming that the API will never take longer than 2 seconds between callbacks. In reality on my PC it is never anywhere near that long between callbacks, it is something like 200 miliseconds, but I have no idea how long it would be on a slower PC and I want this to be completely reliable.
[URL]
View 14 Replies
Feb 25, 2012
I'm currently converting a Visual Basic application to Ruby because we're moving it to the web. However when converting some algorithms I've run into a problem concerning bit shifting.How I understand it, the problem lies in the size mask VB enforces on Integer types (as explained Here). Ruby, in practice, doesn't differentiate in these types.
[Code]...
View 1 Replies
May 20, 2011
This is the general goal I am trying to achieve:My VB.NET program will generate some Lists that may contain booleans, integers, strings, or more lists. I want the program to output a "file" which basically contains such data. It is important that the file cannot be read by humans Okay actually, fine, human-readable data wouldn't be bad.Afterward, I want my Ruby program to take such file and read the contents. The Lists become arrays, and integers, booleans and strings are read alright with Ruby. I just want to be able to read the file, I might not need to write it using Ruby.
View 2 Replies
Sep 10, 2009
I would like you all to give me some links about embeding scripting languages and I would like to ask if it is possible to embed Ruby into a Vb.net application. I only know Vb.net c# and ruby and would prefer not to have to learn c/c++ (even though i probably will have to in the very far future).
View 3 Replies
Apr 19, 2012
I have a finished a software written in ruby on rails. It is possible to convert it to visual basic?
View 3 Replies
Jun 20, 2012
I'm just needing a simple bit of code for vb.net that will allow me to marshal an object into a string, allowing for the saving and loading of this string so I can save my classes, needs to be simple and easy!
View 1 Replies
Apr 4, 2011
How would I create a list of elements in VB.NET, save it to a .dat file, and make Ruby re-create such list (as an array) with such elements (they will be strings, booleans and integers)?
View 2 Replies
Jul 30, 2011
We are trying to communicate between our two applications, One is in VB.Net and the other one is in ruby. We can easily communicate between two .Net applications but how to communicate between a .Net and ruby application? [code] After creating the Memory Mapped File through the above code how can we read/write it in ruby?
View 1 Replies
Aug 1, 2011
read/write from VB.Net to ruby application and vice versa using Memory Mapped Files?
View 3 Replies
Mar 26, 2012
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...]
View 1 Replies
Apr 17, 2011
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
[code].....
View 7 Replies
Aug 22, 2011
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:
[Code]...
View 1 Replies
Nov 2, 2008
im working on a disk cleaner in VB.net 2008. im running into a unauthorized file exception.
[Code]...
View 5 Replies
Jan 10, 2010
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()
[code]....
View 4 Replies
Jun 29, 2011
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.
<location path="documents">
<system.web>
<authorization>
[Code]....
View 1 Replies
Oct 16, 2010
net ,vb. I want to deny users who have not logged in with a message" you have to login to access this page".
View 1 Replies
Oct 30, 2010
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
View 1 Replies
Jan 17, 2011
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
View 1 Replies
Jun 15, 2010
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.
View 1 Replies
Mar 19, 2010
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?
View 2 Replies
Jan 16, 2012
below is my code for posting a value in php code and get response...but I am have an error The remote server returned an error: (401) Unauthorized
ddd
Try
Dim post As String
[code]....
View 3 Replies
May 18, 2010
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?
View 3 Replies
Aug 4, 2010
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] .....
View 11 Replies
May 4, 2011
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
[code]....
View 14 Replies
Sep 19, 2009
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??
View 2 Replies
Apr 23, 2012
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.
View 1 Replies
Jul 12, 2009
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".
View 3 Replies
Jul 15, 2010
I have two methods on the page. One AddMessageToInboxOutbox(params[]) and other one SendNewMessageMail(params[]).
Once user sends an message to other other first message is added to DB and then sent to recipient's email. Sometimes SMTP is heavy loaded and it takes up to 5 seconds to get answer from it. I want to enclose SendNewMessageMail(params[]) with async call using other thread or something. I have never done that.
How do i perform this action right in ASP.NET?
View 2 Replies