15,891,905 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Christiaan Rakowski (Top 25 by date)
Christiaan Rakowski
5-Dec-12 2:52am
View
If you have only one process this way will indeed work fine, I was assuming you were using multiple ones, I should have asked. Also, thanks for the link. It was a good read.
Christiaan Rakowski
5-Nov-12 13:54pm
View
If you look on the pages for the webclient and FileStream class you will see the code needed to do parts 1, 2 and 4. For part 3 you could use the Regex class, for an example Regex take a look at this post: http://stackoverflow.com/questions/5717312/regular-expression-for-url
The Regex class gives you an array of Matches, those containt the next URL to parse (recursivally) in their value.
http://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/system.io.filestream(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.100).aspx
Christiaan Rakowski
29-Oct-12 5:59am
View
Reason for my vote of 4
Nice read, I didn't even know this feature existed. Thanks for the information, it might provide useful some day!
Christiaan Rakowski
10-Oct-12 13:05pm
View
I'm pretty sure this will be possible in C++ via some weird Win32 API, but that's only a guess. I also don't think C# will allow you to do this, since from a security point of view this could lead to many bad things. Again, I a not certain, just assumptions.
Christiaan Rakowski
28-Sep-12 2:23am
View
That's very strange, I have never had that error before, and according to the MSDN article it doesn't even throw InvalidOperationExceptions. Are you sure it's from this line? What does the stacktrace say?
Christiaan Rakowski
27-Sep-12 16:04pm
View
The code looks to be ok, could it be a problem with the SQL connection string?
Try putting a breakpoint at the ExecuteNonQuery and see if that returns a 1 or throws an exception.
Christiaan Rakowski
27-Sep-12 5:14am
View
As far as I know it is always possible to hijack a session somehow, you just need to figure out how the system works and (ab)use it in the right way.
The easiest way to make it a lot harder would be to use some kind of endpoint checking, for example IP based, but that could cause problems if the user's ISP decides to change it right when the user is busy. Though it is only a very small chance that this will ever happen, it is something to keep in mind.
You could use a system like this, but you will need to properly secure the cookie to make tampering as hard as possible. There are many articles around that explain how to go about doing that.
If you go about building this system, I think it will prove an interesting project. I wish you good luck, and look forward to your results.
Christiaan Rakowski
27-Sep-12 4:22am
View
Ah, so you are trying to rotate the Session State servers around, not just the web servers. The question just got even more interesting :-)
I did some Googling just now and came across some interesting articles.
Microsoft Azure uses a distributed system, which they talk about here: http://msdn.microsoft.com/en-us/library/windowsazure/gg278339.aspx
I was unable to find any more details, but it might help you, or others, search for more information.
You could try implementing your own Session State Provider, this does require some work but could be a valid option. You can read more on that here: http://msdn.microsoft.com/en-us/library/ms178587(v=vs.100).aspx
It might be possible, and profitable, to build this upon a distributed Velocity cache with userid based keys. Or using a mirrored SQLServer setup.
There were also some that talked about load balancing the SQLServer, for example by DNS.
I have not tried any of these things myself yet, but they all sound quite interesting and might be worth taking a look at.
Christiaan Rakowski
26-Sep-12 17:17pm
View
MapPath only returns a string with the full path to the folder you gave it, so starting at the drive letter all the way down. In the method Bitmap.FromFile you will need to use the imagePath variable instead of the string. The final code should be:
string imagePath = Server.MapPath("/croppedimages/");
System.Drawing.Image imgToCrop = Bitmap.FromFile(imagePath + FileUpload1.FileName);
Christiaan Rakowski
25-Sep-12 13:22pm
View
I'm not 100% sure, but I think the IIS URL rewrite module supports removing trailing slashes. Take a look into that.
Christiaan Rakowski
25-Sep-12 3:12am
View
When you are in ASP the using relative directory doesn't work (most of the time). You have to use string folder = HttpContext.Current.Server.MapPath("/croppedimages/"); to get the folder, then open the image with Bitmap.FromFile(folder + filename, true);
Christiaan Rakowski
24-Sep-12 12:52pm
View
At the end of this method you set ImagePreview.ImageUrl = "~/Handler.ashx";
I assume this handler will return the image, if so you will have to do the same in the PageLoad method of the page, just copy that 1 line over to there and it should be good.
Small extra advice: jpeg (with the e) is also a valid jpg image, adding that to your check is probably a good idea.
Christiaan Rakowski
24-Sep-12 10:53am
View
I use this way of working quite often for bulk background processing, but never with a real 'busy waiting' scenario, like you have right now. So I can't be a 100% certain it will work for you, and if your code is quite complex then completely rewriting/organizing can be very time consuming. However, this is this the only system I know of that can help in this scenario (other than the request timeout variable in the web.config). I see above that you already tried this, and I find it strange that it will still timeout so quickly. Other than my solution here, another thing might be to just optimize the bulk processing part.
Christiaan Rakowski
24-Sep-12 10:02am
View
An HTTPHandler is kind of like a stripped down ASPX page. To call this code you need to make an AJAX call to the handler. So if the handler is called WorkerHandler.ashx, you can use the button's onclientclick for this: onclientclick="$.get(' WorkerHandler.ashx' ); return false;"
Christiaan Rakowski
24-Sep-12 9:37am
View
Add a new Simple HTTPHandler to your project and fill it with code something like this.
using System.Web;
using System.Threading;
public class WorkHandler : IHttpHandler
{
public bool IsReusable
{
get {return true;}
}
public void ProcessRequest(HttpContext context)
{
Thread thread = new Thread(new ThreadStart(WorkThreadFunction));
thread.Start();
context.Response.Write("Thread started");
}
public void WorkThreadFunction()
{
try
{
// Call methods to do background work
}
catch (Exception ex)
{
// log errors
}
}
}
Christiaan Rakowski
23-Sep-12 8:33am
View
In this case you need to log into your router and set it to forward traffic on port 8001 to the local server.
It depends on the specific router brand what the option is called, I have seen the menus being called: Port Forwarding, (Special) Applications, DMZ, (Advanced) Firewall.
Check here for your specific router: http://portforward.com/english/routers/port_forwarding/routerindex.htm
Christiaan Rakowski
23-Sep-12 5:15am
View
In update eventhandler you don't need to write any code into the DataAdapter anymore (You already did this during the loading of the data). All you need to do is get the DataTable and use da.Update(dt), .NET will take of the rest.
See the documentation of the Update method here: http://msdn.microsoft.com/en-us/library/z1z2bkx2(v=vs.100).aspx
Christiaan Rakowski
23-Sep-12 4:45am
View
What I meant with all buttons attached to the correct event does not apply to your situation, you only have one button and not 3.
There is nothing wrong with the rest of the code as far as I can see.
Maybe it is because of some double used variables for the SQL code, so the query becomes invalid and does not give the correct result?
The simplest way to check this is by cleaning up your code and putting all the code in helper methods so that the code in button1_Click will be like this:
if (tabControl1.SelectedTab == tabPage1)
{
getDataForTab1();
}
else if (tabControl1.SelectedTab == tabPage2)
{
getDataForTab2();
}
else if (tabControl1.SelectedTab == tabPage3)
{
getDataForTab3();
}
If that didn't help, maybe you could upload the whole project somewhere where I can download it, and I will take a closer look at it.
Christiaan Rakowski
22-Sep-12 15:08pm
View
Anything that high is probably unused, and thus a very good choice.
Christiaan Rakowski
22-Sep-12 9:50am
View
The code you posted looks fine, but it has not logic that controls it.
Please post the code that shows/hides the panel, since that is where the problem probably is.
Christiaan Rakowski
22-Sep-12 9:35am
View
I assume the syntax errors in there are because of copy-pasting it into the formatter, but there appear to be some strings where they shouldn't be.
Is button1 inside, or outside of the tabs. (aka is there only 1 button, or are there 3, 1 per page) If it is the second option, are those buttons attached to correct event?
Christiaan Rakowski
22-Sep-12 9:30am
View
I'm not sure why my answer got downvoted, but I would like to know so I can improve it. It's true it's not a solid answer, but there is no solid question to answer either.
Christiaan Rakowski
22-Sep-12 9:01am
View
Assuming you are using Chrome or Firefox in your development, what does the console say? Is it doing the postback, does it give a javascript error, or is it completely empty?
If it is doing the postback, to what page/handler is it going? Is this also the correct page (the one where the TextBox23_TextChanged code is?
If it does postback to the correct page, try renaming the method and see if it gives a compile error. If it does not you have duplicate names (which can happen when you call your items TextBox23)
Christiaan Rakowski
21-Sep-12 17:41pm
View
Good solution, but it would be clearer if you used code tags and indenting in your examples.
Christiaan Rakowski
21-Sep-12 17:16pm
View
Easy solutions are typically the best ones, +5 from me.
Show More