In order for my application (.Net 1.1) to use the system configured proxy server (trough a proxy.pac script) I was using an interop calls to WinHTTP function WinHttpGetProxyForUrl, passing the proxy.pac url I got from the registry.
Unfortunately, I hit a deployment scenario, where this does not work, as the proxy.pac file is deployed locally on the user's hard drive, and the url is "file://C://xxxx"
As clearly stated in the WinHttpGetProxyForUrl docs, it works only with http and https schemes, so it fails with file://
I'm considering 2 "ugly" solutions to the problem (the pac file is javascript):
Creating a separate JScript.NET project, with a single class with single static method Eval(string), and use it to eval in runtime the function read from the pac file
Building at runtime a JScript.NET assembly and load it.
As these solutions are really ugly :), does anybody know a better approach? Is there a Windows function which I can use trough interop?
If not, what are you guys thinking about the above 2 solutions - which one would you prefer?
Just a thought: Why not create a micro web server that can serve the local PAC file over a localhost socket. You should use a random URI for the content so that it is difficult to browse this in unexpected ways.
You could then pass a URL like http://localhost:1234/gfdjklskjgfsdjgklsdfklgfsjkl to the WinHttpGetProxyForUrl function and allow it to pull the PAC file from your micro server.
(hack... hack... hack...)
FWIW: https://web.archive.org/web/20150405115150/http://msdn.microsoft.com/en-us/magazine/cc300743.aspx describes how to use the JScript.NET engine to do this securely.
https://web.archive.org/web/20090220132508/http://msdn.microsoft.com/en-us/library/aa383910(VS.85).aspx explains how to use WinINET's implementation.
Can't answer your problem unfortunately (though a few years ago I played with jscript.net and it would only be a few lines to build and run that way)
I hit a similar proxy.pac hiccup with a personal work-around-the-office-proxy file a while back - in the end I went with the easiest option and dropped it into its own IIS site, and its been rock solid and works flawlessly with everything on my pc.
Sometimes its best to give in and work with what is provided :)
I can't answer you question directly, but working from the mozilla implementation there was a definite debate about supporting file URLs. It was a network control vs. local user convenience debate.
Related
Just need a point in the right direction with this one.
I've created the Cisco Unified Call Manager API via the instructions provided by Cisco, the API for CUCM is called AXL.
It's currently in my C# WPF project and works just fine (i've retrieved some phone data successfully), the issue is that the API is in a single CS file that's 345K lines long. This is causing an extremely long delay when I attempt the first action using the API (after it has compiled).
As one user on the Cisco forum advised:
There is a very high chance that your problem is with the time that it takes the .net framework to generate the xml serialization assembly.
Pre-generate the xml serialization assembly when using AXL on .net and your first response will be MUCH faster.
I've tried to pre-generate it using the instructions from user brain backup in this thread. Unfortunately the first use of the API is still around ~45 seconds (it did reduce it by about a minute). I'm not extremely savvy with the debugging tools within Visual Studio so unsure how to check what exactly is causing the issue (but it certainly looks like an issue related to generating the XML).
I was wondering if anyone could recommend of a way to remove the unnecessary methods from the CS file (99% of it won't be used anyway) without having to manually re-create it. Any type of tool that can pull/delete methods and their dependencies from a CS file would be absolutely brilliant.
There is a way to check whether you method has been used or not and if used how many times and where check this out.
https://visualstudiomagazine.com/Blogs/Tool-Tracker/2014/12/Finding-Method-Property-Variable.aspx
It might make sense to pare the AXL WSDL itself and re-compile - as mentioned, it's unlikely you'll ever use anywhere near the whole schema.
You should be able to just edit AXLAPI.wsdl and remove all of the and elements except for the items you are actually useing.
Had the same issue, it was almost unusable with the delay. Two things that I have found to get around this with almost instant results.
Don't use the WSDL. Write your own methods to handle SOAP requests. Takes time and can be error prone but results are almost instant.
Use a tool that can handle large text files, like Notpad++ to open your WSDL generated code file and take only what methods out that you need. This is the method I've choose and it works great.
Also, I believe you could just use the executeSQLQuery methods and cut out a good portion of the rest of the code but I've yet to try it. Each method above I have tried without pregenerating the xml serialization. I found the problem to be with the generated C# axl code file size.
Sorry if I did not post in the correct StackExchange branch.
I'm searching for a software runnable via command line interface (to be precise, on Windows) to tunnel a single .exe file through a single proxy.
A cli version of Proxifier, for example.
Searching through the net I found this one
http://proxifier.sourceforge.net/ but it's surely outdated and I can't edit and compile the solution to edit the path of the config file.
Can anyone help me?
The possible duplicate indicated by #M.Hassan is different because the OP of that question asked for something that would redirect all the traffic from Windows, I need it for each single application I'll need.
For example:
proxy-software ./path/to/software_i_need_to_be_proxed_a.exe foo:bar#89.89.89.89
proxy-software ./path/to/software_i_need_to_be_proxed_b.exe foo:bar#89.89.89.109
proxy-software ./path/to/software_i_need_to_be_proxed_c.exe foo:bar#123.22.66.99
I'm doing an program, which is running on an local system, with no internet access. Is it possible to create my own custom Web Map Service (WMS) server, using C#. I no that there are free open source system's. But i like to have full control.
Thanks Morten Starck
That is very possible, but you might be in for a headache or two before you are done. The implementation specification and more is available from the Open Geospatial Consortium at the url below.
http://www.opengeospatial.org/standards/wms
It's quite a large specification but you might be able to get away with implementing only the parts you really need and leaving some of the more specific stuff out. You will of course also need to parse and render the map data from some source which might be your largest problem (for which I really would suggest you have a look at SharpMap, http://sharpmap.codeplex.com/ instead of rolling your own).
I am at the earliest stage of writing a desktop application for use by multiple users. I am looking for advice on what is the best way to approach this.
The Spec
I will persist my Model in a file which would often be used on a mapped network drive. (It is for the design of roadways and other linear features like railways and streams.)
The various end users need to be able to connect to and edit the file simultaneously. For example, Billy Bob is working on the road named US321 while Rupert is working on I40. The models for each road live in the same file. End users can "claim" any road name, in which only the claimant can edit the given road. Rupert can't edit US321 while Billy Bob has it claimed, but Rupert can read US321 for reference. Once a user is finished editing the road data, he can release the claim and someone else could edit it.
Limitations on Serialization?
My understanding of Serialization is quite limited (see my profile). But it looks to me like there is a one-to-one correlation between objects and serialization files. So if I use serialization to implement this, it would not be possible to claim just a part of it nor would it be possible to update only a part of it. (Is this correct? If not, then I can use Serialization, right?)
The Solution I am Considering
I am considering using SQL Server Express, and I am interested in the community's warnings, corrections, or affirmations on this.
The end users would not have to know that I am using SQL Server Express in the background. (I would even change the file extension to something suitable to my app.) I would load roads into a list, and each road would be "claimable". Claiming a road would mark it in the database for the other instances of the app to react to accordingly, kind of like it is a shared MS Excel file that multiple people can edit simultaneously, but (in the analogy to Excel) being able to lock individual worksheets.
[Edit] See Micah Armantrout's very informative response, below. So now I am wondering about using Microsoft Access as the intermediating db app.
[Edit]
Conclusion
Thanks to everyone for their helpful answers and comments. Micah's answer was very helpful since I did not realize I would be limited to the file being controled by only one server. Although it makes perfect sense now, I had not anticipated it, and if I had gone that route, I would have run aground on it after many hours of working in that direction.
When I first read urbadave's idea, I dismissed it as something I had already considered and not liked. But after thinking it over, it is clearly the simplest approach. I just use a directory like it is a file, but with user-transparency to my my top level sub-objects. But there clearly is an appeal to having my whole model be encapsualted into a single file.
So this is what I have decided to do: Start with just writing to a directory, just as urbadave suggests. Then later test out putting it in a zip directory and using the ZipPackage class to pluck out and insert the individual serialized files (or XML files -- another decision I have to make some day).
Paul
SQL server will work for what you are looking for but if your going to have multiple users you need to have a machine setup to be a server. It will not do you any good to have sql server express installed on each machine It might be one of the users machines or an actual server with SQL server express you are going to need to set it up to be accessible outside of a current machine to do this follow this tutorial.
If you are using anything past windows XP SP2 you will need to open up the ports of the firewall follow these instructions this is also talked about in the link below.
http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx
As far as sharing data I mean seeing other peoples work. If you are not wanting to install sql server on a server you can use MS Access I would refer you to a article on which one to use when
http://www.techrepublic.com/article/should-you-use-sql-server-express-edition-or-microsoft-access-for-your-small-business-applications/6140859
While I have access to a nice database at work, most of my personal programming does not use a database. One of the tricks I've used in the past is that file extensions are meant to carry meaning. In your case, you can exploit file extensions to indicate claims and control writing to the master file.
You're right, you would want to serialize each road object to its own file. The Master File would be the serialization of a collection object that holds all of these individual road objects.
The users select and open these road files. Before opening the file, the user's app re-names the file, adding an extension (perhaps the user's id). This way, you can use directory scans to find claimed and unclaimed files.
The master file is only written to when the user releases their claim on the road they are working on. The user's app opens all the road files, assembles a master object using the road objects and then serializes this object into the master file. When finished, the users app releases the user's claim on the road file by renaming it.
Before writing to the master file, the user's app renames the file, indicating it is about to be written to. If an users app needs to write, it can check to see if the file is renamed, and wait for the file name to be restored to a writable name.
This is a sketch of how I would attack this spec. Good luck.
I have been looking around for hours trying to find a clear simple solution to my question and have yet to find a good answer. I am trying to do a URL request in flash to my NOPCommerce site. I want to pass a GET value to the my .cs file which i'll then use that value to grab specific information and return it back to flash. How would I set up the C# or asp.net side of things? If anyone could give me an example of what I am looking for I would greatly appreciate it.
I don't know if I am supposed to use a .aspx, .cs or .ascx file.
Thanks,
Brennan
I found it to be extremely simple with web services in as3. Here is a link to see what I mean
As3 Web Services
Use the HttpWebRequest class to GET the variables, do the magic and return a result by invoking the HttpWebRequest again.
Examples and usage here:
http://www.csharp-station.com/HowTo/HttpWebFetch.aspx
You have a few options for server-side communication with flash.
Flash remoting. This is the most popular because it's the most performant, but not the easiest to understand at first glance. It transfers data in a binary format. Available libraries are Weborb and Fluorine.
Web Services as mentioned in a previous post.
Ajax/JSON. I think with Flash Player 11.3, JSON decoding is native in the player now.
Straight up http request.
Sockets (not recommended for beginners)
To answer your question as you asked it, though, for all but #4, you'd be using a CS file to retrieve your data. For #4, you'd most likely be using an .aspx page, but it could be a combination of .aspx and .ascx files.
My recommendation is that you do some research on each of these methods to decide what would work best with your development environment, required level of security, and project. Then, ask specific questions about each method as necessary.
Good Luck!