Pocket IE throws ODBC error but desktop browsers do not - c#

I have a fairly simple CRUD web application (C#/ASP.NET) that runs fine in Firefox, IE7, and Chrome. (I'm accessing and testing the application on our development server.)
When I connect to the dev site via a Pocket PC device and go through the exact same steps, I get an ODBC error. Unfortunately, when I step through the code (once again, on my desktop) I can't duplicate the error. Same environment, different browser. All the code is server side, so I can't figure out why I'm getting different results.
I've run through the code with the Pocket PC emulator and it works fine. It only happens when I access the site via the actual device. I have similar pages, accessing the same ODBC database that don't have this problem on the Pocket PC device.
Anyone ever seen something like this? I'm stumped.
Edit: Here's the text of the ODBC error. The error code '38121' refers to an invalid order number, even though I know for sure that the order number is not invalid. (I'm using the same order number on my desktop as I am on the handheld.) If needed, I can post the stack track too.
****ERROR [HY000] [CA][IDMS ODBC Driver][IDMS]DB001075 C-4M321: Procedure LOEPU041 exception 38121 ?**
Double edit: Chalk it up to user error. The database requires all parameters to be entered in uppercase. On my machine I was used to entering the order number in all uppercase. Since the Pocket PC has a crappy keyboard, I would always just enter it in lowercase. A simple ToUpper() fixed it. Holy crap, I feel dumb.

Check the values are submitted as you
expect them in the request handler
Check the values are passed to the
database statements correctly
Implement server-side error logging /
tracing
Memorize the text of the error
message(s)

Related

Server throws ArgumentNullException only to Android os but not to web or iOS

Right now I am working on a project as a backend developer with C#. I worked on the API that will be called by web, iOS, and Android. I have this method that is supposed to create a record for me and keep track of it, and it asks the user to input a date to record it. Now the issue is, I've tested this method thoroughly using Postman and debugging point, and it's working perfectly. However, the problem came from the android team as they keep getting a ArgumentNullException on a DateTimeParse.Parse.
What's getting on my nerves is that it's only Android that has this issue, iOS works perfectly as well as web browsers, even when I took the exact same request from Android, along with the same credentials, it still didn't work.
Any idea where this exception is coming from? I lost hope after duplicating several requests that failed on Android but worked perfectly on my device (Localhost as well as live website, both works.)
Actually, after more debugging, I figured out where the error is, but now why it's occurring or how to fix it. Within the method call, there's a date parser that is parsing the join date claim of the user, the issue is with that claim. The thing is this issue now occurs to newly registered users through both iOS and Android and also live website, but nothing of this sort happens when I'm testing it locally, even when I'm using the credentials of a user that was created with iOS or Android.
If your service sends correct response, line in JSON format, you must check you fill the value for them, so they don't get exception. If you did and the Android team get exception still, it might be problem with the format you send. Check if you send correct data like, if you send timestamp, they should get it in long data type, then format it accordingly as they wish.

Run c# code on client side or make a web session interactive?

I'm making an application on c# for signing PDFs. Its works perfectly on my visual studio web project, but when I publish it on my test server it throws me this Error
In this case I'm trying to execute the code that sign a pdf on the server and the error occurs specifically on the line:
System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature()
It is supposed to throws a window on your desktop asking for your certificate (reading a smart Card) and then asking for your PIN just like this
Windows Security Window but I have the hunch that it's not possible because Its implies that the server have to have the possibility to interact with the client's desktop
Ok, now that I've explained all the enviroment that I'm facing, here are the solutions I've tried until now:
1) Trying to correct the Server Error above: I went in the server to IIS>application Pool>MyPage>Advanced Settings>Process Model>Load User Profile and selected True instead of False (Didn't Work)
2) Still trying to correct the Server Error I Went to Computer Management>Services and Application>Services and turned on the service "Interactive Service Detection" (Still not working and doesn't work even if I do the same on the client computer)
3)Finally, I guess that it's not possible to run the code on the server because the Error line above is a native calling of Windows Security so I thought: what if I try to run the code right from the client?. Like a c# applet equivalent or something, well... there are two ways for do that: ActiveX (old technology) and Silverlight (newer). The thing is that I just can't make a simple Silverlight program start on chrome, it does on firefox and IE but if doesn't work on chrome is a totally waste so my last option is to make it run with an ActiveX, and there is almost none useful information in the internet about that
If someone can tell me what to do, either to correct the error or to make my program run from the client side, I would be so grateful
You can't call the system's api from a Web client as this would break the sandbox. If you must use that system call, create a wrapper on the server that will handle the popup, although this would be a very "hacky" solution. You should really be asking why I am trying to use a Web client interface if I must use said native system call.

Saving data into SQL using PHP (C#)

I'm working on program (written in C#) that would run on few computers at once (their amount will very likely change over time). I want to save some data into SQL everytime some event occurs (nothing too complex, just a bit of information).
I'm not really sure how to do this the best way. I have these two options, I can connect directly to the SQL database straight from the program and insert everything I need, but I find this rather unsafe because someone could you this in bad way and gain access to my SQL without my permissions.
So I came up with this idea, I will have certain PHP file on the server which will handle all the data (my program will open internal hidden web browser window with address of the PHP file and all needed variables (I will use GET over here) and then it will close and wait for another event to happen).
Is the second solution way too bad habit to do or is it reasonably okay? Or even better, is there any better, more clean, solution to this kind of problem?
(It's not any kind of spyware or anything like that, it's just doing kind of diagnostics on the computer and giving me results with user's knowledge..)
Each time any event occurs, I have to insert one line into the table and it includes computer's ID, time and the event information.
The address used could look somewhat like this http:\\server.com\handle.php?id=xxxxxxxx&time=xx-xx-xxxx-xx-xx-xx-xxx&data=something
Is your application running on a LAN or are you on the Internet?
If you can access your SQL Server directly from your application on the default SQL Port (1433) what kind of security issues do you see?
If you run your application in a certain security context, you can connect to your SQL server using Windows security -> no username and password is sent.
BR
Frank

MySQL Error 2003: Can't connect to MySQL server on 'localhost'

I've been given the task of running a program that relies on a MySQL database, specifically, the 3.23.42 version. I have to install MySQL, run a .batch file that reads an SQL file (to create the required tables and such), then run the program. Seems simple enough.
I got as far as installing MySQL. I was expecting it to ask username and passwords and such, as was my experience with installing SQL Server and MySQL version 5 (and later), but it needed nothing from me. Attempts to run the .batch file, however, yields the error:
"MySQL Error 2003: Can't connect to MySQL server on 'localhost' "
So I ran Command prompt as an administrator, went to the MySQL directory, and ran "mysql". It gave me the same error as above.
Running the commands "mysqld-nt" or "mysqld" didn't do anything, so I'm assuming there's another problem at work here. Neither did I find any 'mysql' in the running services or process.
At this point, it doesn't matter if the program runs or not. I need the database up and running first.
Although I've used MySQL before, I can't say I have that much experience with it, and it had always been up and running already; this is the first time I'm deploying it myself.
Of note is that:
I haven't tried to reinstall the program yet, although I'm not sure if it will fix anything.
I've installed MyODBC-3.15.05, if it means anything (part of the instructions).
I'm using Windows 7, 32-bit (I have heard MySQL doesn't like to play nice with Windows 7).
I'm using this setup as both the server and the client; had the entire process been successful, I was to do the same thing on another computer. No computer actually uses another as a server.
I don't exactly know what services to look for in the services list.
Is there anything I can do to fix this problem?
Early versions of the MySQL installer didn't set up the windows service at all.
You might have to do it by hand.
http://dev.mysql.com/doc/refman/5.1/en/windows-start-service.html
When the service is installed you should be able to enter the following command to start the service.
net start mysql
Then all you need is to open a command window and type the following to get you into the MySQL command line where you can start writing your own queries.
mysql -uroot
I'm not terribly up on Microsoft SQL Server's flavour of SQL but I think that if you are used to using it then you might find it difficult to "get into" MySQL.
Here's a simple tutorial that gives an overview of MySQL and creating queries.
http://www.bigsoft.co.uk/blog/index.php/2012/10/04/sql-for-beginners
Check in Task Manager that mysql server is started.
Check if you can connect to the server, run telnet <hostname> <portnumber>, e.g.:
telnet localhost 3306
If you could not connect, try to find server properties (check port number), also check your firewall.
Look for the file my.ini and add bind-address = 0.0.0.0 in the [mysqld] stanza.
Well, I don't exactly know what caused this issue in the first place, but I was able to find a way to solve it. A helpful, if old - perfect in this case - tutorial I found on the web, that hopefully can help others with the same problem.
Tutorial: Install MySQL 4.0 - Windows, by Dr. Thomas E. Hicks
Computer Science Department
Trinity University
Link Here
I'm not sure if the services application is on other windows or not but if you use Windows 7, you are lucky. The easiest method is to open Start panel,in the search box,type services and hit enter.Now scroll down till you find the mysql service.In the latest version, it is named MySQL57. Right click on it and click on start.
Now you are good to use MySQL. However,you will have to perform this step every time the windows starts.
Open the MySQL Installer and click on where it says "reconfigure" next to "MySQL Server"
if it is showing error 2003 (HY000): Can't connect to MySQL server on localhost (10061) than
1.search services.msc in run
2.goto mysql properties
3.copy the mysql service name
4.start cmd as administrator
5.write: net start mysqlservicename .i.e mysql57 or etc
it will show mysql is starting.

Novell Netware 6 and C#

I don't know if anyone has any expertise with Novell Netware or not, but I situation where one of my clients is getting a weird error trying to move a file to a netware share. The situation is pretty complicated but I'll try and outline it as best I can.
1) The application is running as a service
2) The file to be moved is a local file in an accessible location (to the service)
3) The file is being moved with FileInfo.MoveTo().
4) The MoveTo is throwing an IOException and the message is "a device attached to the system is not functioning".
I'm at a loss as to explain what might be happening. On a side note, it seems that running a small test program interactively using the same method (FileInfo.MoveTo) to the same location works fine so it seems to be associated with the service itself.
Any help would be hugely greatful. Thanks.
Kristofor Wilson
That's normal. Windows services need to login to the server separately, like local users do. When you run your program interactively, it accesses the NetWare server using your, already established, connection. To access the server from the service, your program needs to establish its own connection first.
I am afraid I don't know how to login to NetWare from a C# program, and I am not sure if it is possible to set up your service that it does not need to log in to NetWare. I'd explore one of these ways though.
Oh, almost forgot. If a local user has NetWare volumes mapped to disk drive letters in Windows, like SYS: volume to P: and so on, these mapping will not be visible to the service; it will have to map the volumes to letters separately, or use UNC paths
The later (Last versions) of Netware where able to emulate a windows server whilst still functioning as a Netware server. No big deal to set this up so might be an option for you,.

Categories

Resources