Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Dralken

@Dralken
About
Posts
13
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Domain Name Registrar
    D Dralken

    You can purchase domains through Cloudflare now. They don't have all TLD's, but are constantly adding new ones. They also have very little markup over the base ICANN fees.

    The Lounge business question lounge learning

  • Transitioning back into web development is hell...
    D Dralken

    So I took a look at Knockout, and I can actually read their examples! From the bit that I've seen, I should be able to work with it. Thank you! I have to rewrite all the the javascript I have so far, but maybe this time I'll understand what I'm writing :laugh:

    The Lounge javascript csharp html asp-net architecture

  • Transitioning back into web development is hell...
    D Dralken

    I plan on keeping at it. Programming is just a hobby for me, fortunately, so I have plenty of time to slam my head against it till I've learned it. I don't actually plan on making a career of programming. I don't think I could sit in a cubicle all day, I prefer being physically active when I work. But plugging away at code keeps my brain just as active as my body, even if it does cause me a fair amount of frustration.

    The Lounge javascript csharp html asp-net architecture

  • Transitioning back into web development is hell...
    D Dralken

    So, I decided to try to go back to web development, and I am sincerely regretting it. The last time I did anything with HTML/PHP/JS, was around '04-'06, when I was in high school. Back then, it was fairly simple. You wrote your logic code and database access in PHP, you displayed it through HTML, and maybe did some DOM hacking with JS. The old AJAX was just starting to come about when I last created anything for the web. After awhile, I got bored with web development and pushed more into desktop programming, and went to C# and loved it. Still do. I plan on getting my certification within a year or two. But I digress... Fast forward to... about now. I still enjoy plugging away at C#, but due to the linux-centric web world, I feel like being stuck to Microsoft is holding me back. That, and I just can NOT get my head around ASP.NET MVC. So I started looking into some of these newer (to me) technologies, such as Node.JS, and client-side stuff like Angular. Node.JS intrigues me. Seems like a very useful and powerful backend to a RESTful application. But I'm not a fan of using it for actually rendering a website. So I jumped back over to the old LAMP setup, and found Angular... What. The. Hell? I hated JS before, but now? I want to burn it with fire, and throw the remains into an active volcano, and drop a nuke on said volcano. Having been stuck in the relatively type-strict C#, JS just looks like an absolute mess. How do you know if something is a variable? A function? :mad: (Not actually asking these questions, more just throwing my hands in the air in frustration). The idea of putting anything security related (e.g. cookies, login verification) or logic related into the client side is just appalling to me. The fact that a hacker can easily view the source code of your javascript, and people are putting potentially volatile information there, just makes my skin crawl. I've been attempting over the last week or so to make a single page web application using Angular, and I just feel like I'm stupid. I read all this source code, the API's, examples... and very little of it actually makes any sense. It might just be my lack of knowledge of javascript syntax, but everything just feels so... hacky, I guess the word would be. I'm very much a 'why' type of programmer. I don't care that something works, I want to know WHY it works, and how. I don't like blindly relying on an API to just work. I feel like I either have to give in to this 'new' way of thinking, or cross my arms, give out a solid

    The Lounge javascript csharp html asp-net architecture

  • Odd TypeError being thrown.
    D Dralken

    Wow, I feel like an idiot. I glanced back over my code... and I had the 'req' and 'res' vars reversed. :doh: But I likely wouldn't have noticed if you didn't point out something with the variables.

    JavaScript javascript csharp html database json

  • Odd TypeError being thrown.
    D Dralken

    Working on a website in Node.JS, and I've been doing good so far, but I've hit an error that has me stumped.

    TypeError: Cannot set property 'isSubmitted' of undefined
    at app.post.res.locals.showform (/media/sf_Node.js/SmartCage2/user.js:76:25)
    at Layer.handle [as handle_request] (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/layer.js:95:5)
    at next (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/layer.js:95:5)
    at /media/sf_Node.js/SmartCage2/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/index.js:330:12)
    at next (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/index.js:271:10)
    at jsonParser (/media/sf_Node.js/SmartCage2/node_modules/body-parser/lib/types/json.js:100:40)
    at Layer.handle [as handle_request] (/media/sf_Node.js/SmartCage2/node_modules/express/lib/router/layer.js:95:5)

    The section that's throwing the error:

    app.get('/login', function (res, req) {
    res.locals.isSubmitted = false;
    res.render("user/login.html");
    });

    The odd thing is, I use the same code above this, and it works.

    app.get('/register', function(req,res) {
    res.locals.isPosted = false;
    res.render("user/register.html");
    });

    I have the forms submitted to the corresponding page (/login to /login, /register to /register), and I use the Nunjucks template system to show relevant data depending on how whether it was accessed via GET or POST. I have no idea why it would be throwing the error on one section, but not the other. I do, however, want to note that I barely know Javascript. I've always used strongly typed languages. I don't even like using 'var' in C#.

    JavaScript javascript csharp html database json

  • Programmatically login to website that uses 2 steps.
    D Dralken

    Normally, I'd agree with you 100%. However, the only thing you can do with this website is check your balance and the latest activity on your account. Neither the card number nor my social are listed on there. And in order to change anything on the account, you need to call customer service and provide both of those. It's not a bank account, per say, just a payroll deposit account with a debit card attached. If it was anything more, I'd not even consider doing this myself. And in the 4 years I've had the account, the front page hasn't changed, nor have I been asked for anything other than my dob

    C# help html security question

  • Programmatically login to website that uses 2 steps.
    D Dralken

    I'm working on making an app that scrapes my debit card account for my current balance and account activity. (I recently bought a Windows Phone, and they don't have an app for WP, and their website is not mobile friendly). I'm running into an issue that has me a bit stumped. They use 2 steps for authentication. The first form submits the username and password, the 2nd asks for your date of birth as a secondary authentication. I'm not sure where it's failing. I know the first request is good, as it brings up the DOB verify page, however after posting the DOB data, the 3rd response is back at the login screen. The cookie headers are being filled, and all the response codes seem to be good. Does anyone see where the potential problem might be in this?

    		HttpWebRequest http = WebRequest.Create(LoginURL) as HttpWebRequest;
    		http.KeepAlive = true;
    		http.Method = "POST";
    		http.ContentType = "application/x-www-form-urlencoded";
    		//http.CookieContainer = AuthCookies;
    		string postData = "languageCode=&reqType=&j\_username=myuser&j\_password=mypass&sign-in.x=29&sign-in.y=7";
    		byte\[\] dataBytes = UTF8Encoding.UTF8.GetBytes(postData);
    		http.ContentLength = postData.Length;
    
    		using (Stream postStream = http.GetRequestStream())
    		{
    			postStream.Write(dataBytes, 0, dataBytes.Length);
    		}
    
    		HttpWebResponse httpResponse = http.GetResponse() as HttpWebResponse;
    		//foreach (Cookie ck in httpResponse.Cookies)
    		//{
    		//	AuthCookies.Add(ck);
    		//}
    		using (Stream respStream = httpResponse.GetResponseStream())
    		{
    			StreamReader reader = new StreamReader(respStream, Encoding.UTF8);
    			File.WriteAllText("loginresp.html", reader.ReadToEnd());
    			reader.Close();
    		}
    
    		//DOB Verify
    		httpResponse.Close();
    		HttpWebRequest http2 = WebRequest.Create(DOBVerifyURL) as HttpWebRequest;
    		http2.KeepAlive = true;
    		http2.Method = "POST";
    		http2.ContentType = "application/x-www-form-urlencoded";
    		//http2.CookieContainer = AuthCookies;
    		http2.Headers\["Cookie"\] = httpResponse.Headers\["Set-Cookie"\];
    		http2.Referer = LoginURL;
    		http2.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36";
    		postData = "reqType=&cmd=checkSecu&languageCode=&additionalHolderAuthValue=urlencodeddob&continue.x=86&continue.y=13";
    		dataBytes = UTF8Encoding.UTF8.GetBytes(postData);
    		http2.ContentLength = postData.Length;
    		using (Stream postStream = http2.GetRequestStream())
    		{
    			pos
    
    C# help html security question

  • [Solved] Run application until Tasks are finished?
    D Dralken

    Thanks, I'll check it out.

    C# help data-structures xml question

  • [Solved] Run application until Tasks are finished?
    D Dralken

    Thank you, I hadn't thought of using .ToArray() on a List. Forgot I could, honestly. I'll give it a try and, if it works, I'll mark this as solved. Edit: Worked perfectly! Thank you very much!

    C# help data-structures xml question

  • [Solved] Run application until Tasks are finished?
    D Dralken

    Problem with Task.WaitAll() is that it expects a fixed array (Task[]) of tasks, whereas the array could be anything from a single task to a dozen of them, and it's not known at run time. The tasks are also created and start in a separate function from the Main() function. I suppose I could (and might end up needing to) cram everything into Main() but I'm trying to avoid that as much as possible. (Also, it's Pastebin, you're not downloading anything [besides overall web cache of the website], it's just a copy-paste of my code with syntax highlighting.)

    C# help data-structures xml question

  • [Solved] Run application until Tasks are finished?
    D Dralken

    I'm writing an application that performs a few independant tasks in the background. It's a console application. My issue is that when the program is run, it starts to execute some of the stuff on the threads (processes maybe 1-2 lines of code) then quits before all the tasks are finished (I'm using the Task library, rather than standard Threads) Rather than cramming all of my code into the Main() function, I'm separating them out into different functions for readability. If I add a Console.ReadKey() at the end of the Main function, all the tasks run properly (they only take maybe 1-2 seconds, though over time that could change to several minutes, as it's performing file operations) and close properly when I hit a button. However, once I'm finished with it, I don't want to have make the user do any inputs (it's going to be a "scheduled" task), in fact the window won't even be shown. Part of my problem is that, by the nature of my program, I can't ever be completely sure of how many tasks are going to be running. The program pulls in a list of what needs to be done from an xml file. Is there a safe way to perhaps create a list of tasks, then at the end of the Main() function, have it wait till all those tasks are complete before the program closes? I tried using a

    List

    but it didn't seem very safe, as I'd be building the array with other functions then doing a foreach() on the list and starting each task.

    C# help data-structures xml question

  • Best URL/File Structure Practices?
    D Dralken

    I'm pretty new to ASP.NET, building my first simple website using C#/RazorV2, hosting it on the free Windows Azure site. I've found plenty of articles explaining how the URL structure works, and I've mostly got it figured out, but what I'm wondering is, what's the best/safest/most correct way of doing it? Is it better to actually have multiple smaller files to handle things? Or is it "OK" or accepted to have one file handle several things? For example, I'm building a simple blog web app, and right now I'm using single files to handle multiple sections, like I have a Blog.cshtml:

    if (urlDepth > 0) {
    renderPost = new List();
    switch (UrlData[0]) {
    case "Post":
    int _postID = 0;
    _postID = Convert.ToInt32(UrlData[1]);
    renderPost.Add(blogRender.ShowSinglePost(_postID));
    Page.Title = renderPost[0].Name;
    break;
    case "Category":
    BlogCategory selCat = catDisplay.GetCategory(UrlData[1]);
    Page.Title = selCat.Name;
    renderPost = blogRender.PostsInCategory(selCat.ID);
    break;
    }
    } else {
    renderPost = blogRender.MultiplePosts(10);
    }

    I know it's a bit crude as it is, but it's a work-in-progress, I plan on making it more failsafe as I go. But before I get too deep into it and possibly end up needing to tear it apart, would it be better to actually just make a folder named Blog, and have separate Post.cshtml and Category.cshtml files to handle their respective areas? Figure it's best to know now so I can fix it if need be, rather than find out down the road that I messed up and have to try and pry apart the code. If someone wants to see it in action to get a better idea of what I'm doing, it's currently at http://vouksh.azurewebsites.net/

    ASP.NET csharp asp-net hosting cloud help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups