#TempData
Explore tagged Tumblr posts
Photo
ASP.NET MVC: TempData vs Session and When to use what? http://www.webcodeexpert.com/2017/01/aspnet-mvc-tempdata-vs-session-and-when.html
In this article you will learn the following:
1) What is the Difference and Similarity between TempData and Session? 2) When to use TempData and Session?
0 notes
Text
Something Awesome Natas 11
This is a very long posting because the challenge is actually a little logically challenging. I spent a day going over my logic for this before realising I just forgot to do a base64 encode tho, so maybe I’m molto retardio.
I also recommend that it’s done on #ffffff because the key is dynamic based on the input (changing the colour changes the cookie, and the key is dependant on the colour).
First things first, we should follow the clue: Cookies are protected by XOR encryption. Because of the properties of the XOR function, this means 3 things:
1) DATA ^ KEY == ENCRYPTED 2) DATA ^ ENCRYPTED == KEY 3) ENCRYPTED ^ KEY == DATA
where ^ == `XOR` and order of operation is unimportant.
Now that we know this is a cookie challenge, let’s F12 on chrome and check the cookies. Observe that there’s an extra one compared to other challenges.
After storing the data value in python, we also need to sanitise it by recognising that %3D is the percent equivalent of “ = ” (which is used as a padding to reach a multiple of 4 for any encoding/decoding which require mod 4).
Now let’s take a look at the source code.
OK, that’s actually a lot of reading. However, let’s try and break it down.
The function loadData takes the cookie and performs:
$tempdata = json_decode(xor_encrypt(base64_decode($_COOKIE["data"])), true);
After performing a series of checks to make sure you haven’t done anything the challenge doesn’t want you to do, it then passes it onto $mydata which is later passed to the loadData function used to dynamically display html. Note that $defaultdata at the very top sets “showpassword” to “no” meaning that before we pass our fake cookie back in, we need to set that to “true” or “yes”.
So did you catch all that? If not, here’s a simpler explanation:
1) $defaultdata is set to not show passwords. 2) $defaultdata is passed into $loadData, which uses it as a base and stores it into $myData 3) If $tempdata exists, it’s used instead ($tempdata is the info from the cookie) and put into $mydata 4) $loadData then calls $mydata, which theoretically doesn’t show passwords
So how do we exploit this? Well, we need to set the cookie that $tempdata decodes to have the field “showpassword” as “yes”.
With that in mind, let’s now construct a plausible way for that to occur.
1) Obtain DATA 2) Obtain ENCRYPTED 3) Perform DATA ^ ENCRYPTED to obtain KEY 4) Modify DATA so “showpassword” is now true 5) Perform KEY ^ NEW_DATA to obtain NEW_ENCRYPTED 6) Chuck that shit into the cookie field and refresh the page Y E E T
We already have ENCRYPTED so that’s step (2) done, but where do we find DATA for step (1)? Well, by looking at the code, we see that it’s simply defaultdata (it’s being passed into the loadData function on the line where $data = loadData($defaultdata) )
Fortunately for us, we can now perform DATA ^ ENCRYPTED for step (3). We need to get rid of the json and base64 encoding so by applying base64 for the RHS and json to the LHS, we get the code:
To be fair, I should’ve used chr() on the line print(string) because the output was
but I just chucked it into google and it gave me qw8Jqw8J.... which is the key!
(ignore the 44 by the way, that was a debug statement)
So now we have the key, let’s move onto step (4). That’s easy enough:
Step (5) now demands that we basically reverse the steps of the code above. So by swapping around some stuff so now we XOR before we base64, we get the code:
And the output:
Which is the encrypted base64′ed, XOR’ed and JSON’ed thing that goes into the cookie field ready for step (6).
Now we just copy that into the cookie field and refresh! And that’s challenge 11!
1 note
·
View note
Text
Dot Net Core Interview Questions and Answers - Part 21:
Q204. What are the different ways of the Session and State management in ASP .NET Core? Q205. What are cookies? How can you enable cookies in ASP .Net Core? Q206. What is Session State? How can you enable the session state in ASP .Net Core? Q207. What is caching or response caching? How can you enable caching in ASP .Net Core? Q208. What is an In-Memory cache? How can you use the in-memory cache in ASP .NET Core? Q209. What is Cache busting? How Cache busting is handled in ASP .NET Core? Q210. What is Query String? Q211. What are Hidden Fields? Q212. What is TempData? Q213. What are the different ways to pass data from controller to view in ASP .Net Core?
Please visit www.techpointfunda.com for more Interview Questions and Answers.
#dotnetcoreinterviewquestions#aspdotnetcore#coreinterviewquestionsandanswers#CSharpInterviewQuestionsAndAnswers#dotnetInterview#techpointfundamentals#techpointfunda#techpoint#csharpprogramming#csharp#DotNet
1 note
·
View note
Text
300+ TOP ASP.NET MVC Interview Questions and Answers
asp.net mvc interview questions for freshers experienced :-
1. What is ASP.NET MVC? ASP.NET MVC is a web application Framework. It is light weight and highly testable Framework. MVC separates application into three components — Model, View and Controller. 2. Can you explain Model, Controller and View in MVC? Model — It’s a business entity and it is used to represent the application data. Controller — Request sent by the user always scatters through controller and it’s responsibility is to redirect to the specific view using View() method. View — It’s the presentation layer of MVC. 3. Explain the new features added in version 4 of MVC (MVC4)? Following are features added newly – Asynchronous controller task support. Bundling the java scripts. Segregating the configs for MVC routing, Web API, Bundle etc. Mobile templates Added ASP.NET Web API template for creating REST based services. Asynchronous controller task support. Bundling the java scripts. Segregating the configs for MVC routing, Web API, Bundle etc. 4. Can you explain the page life cycle of MVC? Below are the processed followed in the sequence - App initialization Routing Instantiate and execute controller Locate and invoke controller action Instantiate and render view. 5. What are the advantages of MVC over ASP.NET? Provides a clean separation of concerns among UI (Presentation layer), model (Transfer objects/Domain Objects/Entities) and Business Logic (Controller). Easy to UNIT Test. Improved reusability of model and views. We can have multiple views which can point to the same model and vice versa. Improved structuring of the code. 6. What is Separation of Concerns in ASP.NET MVC? It’s is the process of breaking the program into various distinct features which overlaps in functionality as little as possible. MVC pattern concerns on separating the content from presentation and data-processing from content. 7. What is Razor View Engine? Razor is the first major update to render HTML in MVC 3. Razor was designed specifically for view engine syntax. Main focus of this would be to simplify and code-focused templating for HTML generation. Below is the sample of using Razor: @model MvcMusicStore.Models.Customer @{ViewBag.Title = “Get Customers”;} @Model.CustomerName 8. What is the meaning of Unobtrusive JavaScript? This is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). Unobtrusive JavaScript doesn’t intermix JavaScript code in your page markup. Eg : Instead of using events like onclick and onsubmit, the unobtrusive JavaScript attaches to elements by their ID or class based on the HTML5 data- attributes. 9. What is the use of ViewModel in MVC? ViewModel is a plain class with properties, which is used to bind it to strongly typed view. ViewModel can have the validation rules defined for its properties using data annotations. 10. What you mean by Routing in MVC? Routing is a pattern matching mechanism of incoming requests to the URL patterns which are registered in route table. Class — “UrlRoutingModule” is used for the same process.
ASP.NET MVC Interview Questions 11. What are Actions in MVC? Actions are the methods in Controller class which is responsible for returning the view or json data. Action will mainly have return type — “ActionResult” and it will be invoked from method — “InvokeAction()” called by controller. 12. What is Attribute Routing in MVC? ASP.NET Web API supports this type routing. This is introduced in MVC5. In this type of routing, attributes are being used to define the routes. This type of routing gives more control over classic URI Routing. Attribute Routing can be defined at controller level or at Action level like – — Controller Level — Action Level 13. How to enable Attribute Routing? Just add the method — “MapMvcAttributeRoutes()” to enable attribute routing as shown below public static void RegistearRoutes(RouteCollection routes) { routes.IgnoareRoute(“{resource}.axd/{*pathInfo}”); //enabling attribute routing routes.MapMvcAttributeRoutes(); //convention-based routing routes.MapRoute ( name: “Default”, url: “{controller}/{action}/{id}”, defaults: new { controller = “Customer”, action = “GetCustomerList”, id = UrlParameter.Optional } ); } 14. What is JSON Binding? JavaScript Object Notation (JSON) binding support started from MVC3 onwards via the new JsonValueProviderFactory, which allows the action methods to accept and model-bind data in JSON format. This is useful in Ajax scenarios like client templates and data binding that need to post data back to the server. 15. What is Dependency Resolution? Dependency Resolver again has been introduced in MVC3 and it is greatly simplified the use of dependency injection in your applications. This turn to be easier and useful for decoupling the application components and making them easier to test and more configurable. 16. Explain Bundle.Config in MVC4? “BundleConfig.cs” in MVC4 is used to register the bundles by the bundling and minification system. Many bundles are added by default including jQuery libraries like — jquery.validate, Modernizr, and default CSS references. 17. How route table has been created in ASP.NET MVC? Method — “RegisterRoutes()” is used for registering the routes which will be added in “Application_Start()” method of global.asax file, which is fired when the application is loaded or started. 18. Which are the important namespaces used in MVC? Below are the important namespaces used in MVC - System.Web.Mvc System.Web.Mvc.Ajax System.Web.Mvc.Html System.Web.Mvc.Async 19. What is ViewData? Viewdata contains the key, value pairs as dictionary and this is derived from class — “ViewDataDictionary“. In action method we are setting the value for viewdata and in view the value will be fetched by typecasting. 20. What is the difference between ViewBag and ViewData in MVC? ViewBag is a wrapper around ViewData, which allows to create dynamic properties. Advantage of viewbag over viewdata will be – In ViewBag no need to typecast the objects as in ViewData. ViewBag will take advantage of dynamic keyword which is introduced in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData. 21. Explain TempData in MVC? TempData is again a key, value pair as ViewData. This is derived from “TempDataDictionary” class. TempData is used when the data is to be used in two consecutive requests, this could be between the actions or between the controllers. This requires typecasting in view. 22. What are HTML Helpers in MVC? HTML Helpers are like controls in traditional web forms. But HTML helpers are more lightweight compared to web controls as it does not hold viewstate and events. HTML Helpers returns the HTML string which can be directly rendered to HTML page. Custom HTML Helpers also can be created by overriding “HtmlHelper” class. 23. What are AJAX Helpers in MVC? AJAX Helpers are used to create AJAX enabled elements like as Ajax enabled forms and links which performs the request asynchronously and these are extension methods of AJAXHelper class which exists in namespace — System.Web.Mvc. 24. What are the options can be configured in AJAX helpers? Below are the options in AJAX helpers – Url — This is the request URL. Confirm — This is used to specify the message which is to be displayed in confirm box. OnBegin — Javascript method name to be given here and this will be called before the AJAX request. OnComplete — Javascript method name to be given here and this will be called at the end of AJAX request. OnSuccess — Javascript method name to be given here and this will be called when AJAX request is successful. OnFailure — Javascript method name to be given here and this will be called when AJAX request is failed. UpdateTargetId — Target element which is populated from the action returning HTML. 25. What is Layout in MVC? Layout pages are similar to master pages in traditional web forms. This is used to set the common look across multiple pages. In each child page we can find — /p> @{ Layout = “~/Views/Shared/TestLayout1.cshtml”; } This indicates child page uses TestLayout page as it’s master page. 26. Explain Sections is MVC? Section are the part of HTML which is to be rendered in layout page. In Layout page we will use the below syntax for rendering the HTML – @RenderSection(“TestSection”) And in child pages we are defining these sections as shown below – @section TestSection{
Test Content
} If any child page does not have this section defined then error will be thrown so to avoid that we can render the HTML like this – @RenderSection(“TestSection”, required: false) 27. Can you explain RenderBody and RenderPage in MVC? RenderBody is like ContentPlaceHolder in web forms. This will exist in layout page and it will render the child pages/views. Layout page will have only one RenderBody() method. RenderPage also exists in Layout page and multiple RenderPage() can be there in Layout page. 28. What is ViewStart Page in MVC? This page is used to make sure common layout page will be used for multiple views. Code written in this file will be executed first when application is being loaded. 29. Explain the methods used to render the views in MVC? Below are the methods used to render the views from action - View() — To return the view from action. PartialView() — To return the partial view from action. RedirectToAction() — To Redirect to different action which can be in same controller or in different controller. Redirect() — Similar to “Response.Redirect()” in webforms, used to redirect to specified URL. RedirectToRoute() — Redirect to action from the specified URL but URL in the route table has been matched. 30. What are the sub types of ActionResult? ActionResult is used to represent the action method result. Below are the subtypes of ActionResult – ViewResult PartialViewResult RedirectToRouteResult RedirectResult JavascriptResult JSONResult FileResult HTTPStatusCodeResult 31. What are Non Action methods in MVC? In MVC all public methods have been treated as Actions. So if you are creating a method and if you do not want to use it as an action method then the method has to be decorated with “NonAction” attribute as shown below – public void TestMethod() { // Method logic } 32. How to change the action name in MVC? “ActionName” attribute can be used for changing the action name. Below is the sample code snippet to demonstrate more – public ActionResult TestAction() { return View(); } So in the above code snippet “TestAction” is the original action name and in “ActionName” attribute, name — “TestActionNew” is given. So the caller of this action method will use the name “TestActionNew” to call this action. 33. What are Code Blocks in Views? Unlike code expressions that are evaluated and sent to the response, it is the blocks of code that are executed. This is useful for declaring variables which we may be required to be used later. @{ int x = 123; string y = “aa”; } 34. What is the “HelperPage.IsAjax” Property? The HelperPage.IsAjax property gets a value that indicates whether Ajax is being used during the request of the Web page. 35. How we can call a JavaScript function on the change of a Dropdown List in MVC? Create a JavaScript method: function DrpIndexChanged() { } Invoke the method: x.SelectedProduct, new SelectList(Model.Customers, “Value”, “Text”), “Please Select a Customer”, new { id = “ddlCustomers”, onchange=” DrpIndexChanged ()” })%> 36. What are Validation Annotations? Data annotations are attributes which can be found in the “System.ComponentModel.DataAnnotations” namespace. These attributes will be used for server-side validation and client-side validation is also supported. Four attributes — Required, String Length, Regular Expression and Range are used to cover the common validation scenarios. 37. Why to use Html.Partial in MVC? This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods. We can use this like below – @Html.Partial(“TestPartialView”) 38. What is Html.RenderPartial? Result of the method — “RenderPartial” is directly written to the HTML response. This method does not return anything (void). This method also does not depend on action methods. RenderPartial() method calls “Write()” internally and we have to make sure that “RenderPartial” method is enclosed in the bracket. Below is the sample code snippet –@{Html.RenderPartial(“TestPartialView”); } 39. What is RouteConfig.cs in MVC 4? “RouteConfig.cs” holds the routing configuration for MVC. RouteConfig will be initialized on Application_Start event registered in Global.asax. 40. What are Scaffold templates in MVC? Scaffolding in ASP.NET MVC is used to generate the Controllers,Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views. 41. Explain the types of Scaffoldings. Below are the types of scaffoldings – Empty Create Delete Details Edit List 42. Can a view be shared across multiple controllers? If Yes, How we can do that? Yes, we can share a view across multiple controllers. We can put the view in the “Shared” folder. When we create a new MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages. 43. What are the components required to create a route in MVC? Name — This is the name of the route. URL Pattern — Placeholders will be given to match the request URL pattern. Defaults –When loading the application which controller, action to be loaded along with the parameter. 44. Why to use “{resource}.axd/{*pathInfo}” in routing in MVC? Using this default route — {resource}.axd/{*pathInfo}, we can prevent the requests for the web resources files like — WebResource.axd or ScriptResource.axd from passing to a controller. 45. Can we add constraints to the route? If yes, explain how we can do it? Yes we can add constraints to route in following ways – Using Regular Expressions Using object which implements interface — IRouteConstraint. 46. What are the possible Razor view extensions? Below are the two types of extensions razor view can have – .cshtml — In C# programming language this extension will be used. .vbhtml — In VB programming language this extension will be used. 47. What is PartialView in MVC? PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it’s been shared with multiple views these are kept in shared folder. Partial Views can be rendered in following ways – Html.Partial() Html.RenderPartial() 48. How we can add the CSS in MVC? Below is the sample code snippet to add css to razor views – 49. Can I add MVC Testcases in Visual Studio Express? No. We cannot add the test cases in Visual Studio Express edition it can be added only in Professional and Ultimate versions of Visual Studio. 50. What is the use .Glimpse in MVC? Glimpse is an open source tool for debugging the routes in MVC. It is the client side debugger. Glimpse has to be turned on by visiting to local url link - http://localhost:portname//glimpse.axd This is a popular and useful tool for debugging which tracks the speed details, url details etc. asp.net mvc questions and answers Pdf Download Read the full article
0 notes
Text
Alert-using-ThingSpeak+ESP32-Wireless-Temp- Humidity-Sensor
Story
In this tutorial, we will measure different temperature and humidity data using Temp and humidity sensor. You will also learn how to send this data to ThingSpeak. So that you can create a temp alert in your mail at a particular value.
Hardware :
ESP-32: The ESP32 makes it easy to use the Arduino IDE and the Arduino Wire Language for IoT applications. This ESp32 IoT Module combines Wi-Fi, Bluetooth, and Bluetooth BLE for a variety of diverse applications. This module comes fully-equipped with 2 CPU cores that can be controlled and powered individually, and with an adjustable clock frequency of 80 MHz to 240 MHz. This ESP32 IoT WiFi BLE Module with Integrated USB is designed to fit in all ncd.io IoT products. Monitor sensors and control relays, FETs, PWM controllers, solenoids, valves, motors and much more from anywhere in the world using a web page or a dedicated server. We manufactured our own version of the ESP32 to fit into NCD IoT devices, offering more expansion options than any other device in the world! An integrated USB port allows easy programming of the ESP32. The ESP32 IoT WiFi BLE Module is an incredible platform for IoT application development. This ESP32 IoT WiFi BLE Module can be programmed using the Arduino IDE.
IoT Long Range Wireless Temperature And Humidity Sensor: Industrial Long Range Wireless Temperature Humidity Sensor. Grade with a Sensor Resolution of ±1.7%RH ±0.5° C.Up to 500,000 Transmissions from 2 AA Batteries.Measures -40°C to 125°C with Batteries that Survive these Ratings.Superior 2-Mile LOS Range & 28 miles with High-Gain Antennas.Interface to Raspberry Pi, Microsoft Azure, Arduino and More
Long-Range Wireless Mesh Modem with USB Interface
Software Used:
Arduino IDE
ThingSpeak
IFTTT
Library Used:
PubSubClient Library
Wire.h
Arduino Client for MQTT
This library provides a client for doing simple publish/subscribe messaging with a server that supports MQTT
For more information about MQTT, visit mqtt.org.
Download
The latest version of the library can be downloaded from GitHub
Documentation
The library comes with a number of example sketches. See File > Examples > PubSubClient within the Arduino application. Full API Documentation.
Compatible Hardware
The library uses the Arduino Ethernet Client API for interacting with the underlying network hardware. This means it Just Works with a growing number of boards and shields, including:
Arduino Ethernet
Arduino Ethernet Shield
Arduino YUN – use the included YunClient in place of EthernetClient, and be sure to do a Bridge.begin() first
Arduino WiFi Shield - if you want to send packets greater than 90 bytes with this shield, enable the MQTT_MAX_TRANSFER_SIZE option in PubSubClient.h.
Sparkfun WiFly Shield – when used with this library
Intel Galileo/Edison
ESP8266
ESP32The library cannot currently be used with hardware based on the ENC28J60 chip – such as the Nanode or the Nuelectronics Ethernet Shield. For those, there is an alternative library available.
Wire Library
The Wire library allows you to communicate with I2C devices, often also called "2 wire" or "TWI" (Two Wire Interface), can download from Wire.h
Basic Usage
Wire.begin()Begin using Wire in master mode, where you will initiate and control data transfers. This is the most common use when interfacing with most I2C peripheral chips.
Wire.begin(address)Begin using Wire in slave mode, where you will respond at "address" when other I2C masters chips initiate communication.
Transmitting
Wire.beginTransmission(address)Start a new transmission to a device at "address". Master mode is used.
Wire.write(data)Send data. In master mode, beginTransmission must be called first.
Wire.endTransmission()In master mode, this ends the transmission and causes all buffered data to be sent.
Receiving
Wire.requestFrom(address, count)Read "count" bytes from a device at "address". Master mode is used.
Wire.available()Returns the number of bytes available by calling receive.
Wire.read()Receive 1 byte.
Uploading the code to ESP32 using Arduino IDE:
Before uploading the code you can view the working of this sensor at a given link.
Download and include the PubSubClient Library and Wire.h Library.
You must assign your API key, SSID (WiFi Name) and Password of the available network.
Compile and upload the Temp-ThinSpeak.ino code.
To verify the connectivity of the device and the data sent, open the serial monitor. If no response is seen, try unplugging your ESP32 and then plugging it again. Make sure the baud rate of the Serial monitor is set to the same one specified in your code 115200.
Serial monitor output.

OUTPUT
Create an IFTTT Applet
To send data to ThingSpeak you can view it at this link.
IFTTT is a web service that lets you create applets that act in response to another action. You can use the IFTTT Webhooks service to create web requests to trigger an action. The incoming action is an HTTP request to the webserver, and the outgoing action is an email message.
First, create an IFTTT account.
Create an applet. Select My Applets.
Click the New Applet button.
Select the input action. Click the word this.
Click the Webhooks service. Enter Webhooks in the search field. Select the Webhooks.
Choose a trigger.
Complete the trigger fields. After you select Webhooks as the trigger, click the Receive a web request box to continue. Enter an event name.
Create trigger.
Now the trigger is created, for resulting action click That.
Enter email in the search bar, and select the Email box.

Now choose action. Select the Send me an email box and then enter the message information.
Retrieve your Webhooks trigger information. Select My Applets, Services and search for Webhooks. Click Webhooks and Documentation button. You see your key and the format for sending a request. Enter the event name. The event name for this example is Vibration And TempData. You can test the service using the test button or by pasting the URL into your browser.
Create a MATLAB Analysis
You can use the result of your analysis to trigger web requests, such as writing a trigger to IFTTT.
Click Apps, MATLAB Analysis and select New.
Select Trigger Email from IFTTT in the Examples section. The code below is prepopulated in your MATLAB analysis window.
Name your analysis and modify the code.
Save your MATLAB Analysis.
Create a Time Control to Run Your Analysis
Evaluate your ThingSpeak channel data and trigger other events.
Click Apps, TimeControl, and then click New TimeControl.
Save your TimeControl.
OUTPUT
0 notes
Text
Natas 10-12
Natas 10:
This one is quite similar with natas 9, but in this level, we cannot use any command include ‘ /[;|&]/ ’. So we need to use grep itself to find the password.
OK an obvious way is to grep guess a letter in the password and just grep it, like “ grep -i a /etc/natas_webpass/natas11”. And we can guess until we get the password, not so far away: grep -i f /etc/natas_webpass/natas11
Natas 11:
This one includes a long source code and seems to be quite hard.
$defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff");
function xor_encrypt($in) {
$key = '<censored>';
$text = $in;
$outText = '';
// Iterate through each character
for($i=0;$i<strlen($text);$i++) {
$outText .= $text[$i] ^ $key[$i % strlen($key)];
}
return $outText;
}
function loadData($def) {
global $_COOKIE;
$mydata = $def;
if(array_key_exists("data", $_COOKIE)) {
$tempdata = json_decode(xor_encrypt(base64_decode($_COOKIE["data"])), true);
if(is_array($tempdata) && array_key_exists("showpassword", $tempdata) && array_key_exists("bgcolor", $tempdata)) {
if (preg_match('/^#(?:[a-f\d]{6})$/i', $tempdata['bgcolor'])) {
$mydata['showpassword'] = $tempdata['showpassword'];
$mydata['bgcolor'] = $tempdata['bgcolor'];
}
}
}
return $mydata;
}
function saveData($d) {
setcookie("data", base64_encode(xor_encrypt(json_encode($d))));
}
$data = loadData($defaultdata);
if(array_key_exists("bgcolor",$_REQUEST)) {
if (preg_match('/^#(?:[a-f\d]{6})$/i', $_REQUEST['bgcolor'])) {
$data['bgcolor'] = $_REQUEST['bgcolor'];
}
}
saveData($data);
Read the code and we know how it works:
1. First we get the default data = array( "showpassword"=>"no", "bgcolor"=>"#ffffff");
2. Then we come to the loadData() in line 16. This function is reading data from cookie and apply json_decode(xor_encrypt(base64_decode(data))). Then it check if the decoded thing is an array, if yes, it will update $mydata or it will remain the default one. Finally return mydata.
3. Then it will save $mydata to the cookie.
So what we need to do is to have an array with “showpassword” = “yes”, then we need to encode and encrypt it. Encoding is easy but the problem is how to encrypt it since we do not know the key. So we need to do some research of xor_encrypt.
Wikipedia is enough, this approach is quite simple: compute plaintext xor key.
We know that
(A xor key = C ) => ( A xor C = key)
So since we know A and C, we can get the key easily. It is a known-plaintext attack.
So we can write code to get the key then encrypt and encode the array we need to get the password.
First get the key:
And we get the key ‘qw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jq’
Then encode our array:
Natas 12:
It has a long content, but the main issue is that the file checking is done locally. So we can download the file and edit the code. Then we open the modified code in the browser and upload our php code to get the password
0 notes
Text
Passing Data From Controller To View With TempData - Part Four
This article will tell you almost everything you need to know about passing data from Controller to View in ASP.NET MVC using TempData. I am writing this article to tell you the basic to advance foremost concepts about ways to pass data from Controller to View. This article is the fourth one in the series named “Passing Data from Controller to View”. You’ll learn all the ways in each separate article. source https://www.c-sharpcorner.com/article/passing-data-from-controller-to-view-with-tempdata-part-four/ from C Sharp Corner https://ift.tt/2O7Ds2j
0 notes
Text
Passing Data From Controller To View With TempData - Part Four
This article will tell you almost everything you need to know about passing data from Controller to View in ASP.NET MVC using TempData. I am writing this article to tell you the basic to advance foremost concepts about ways to pass data from Controller to View. This article is the fourth one in the series named “Passing Data from Controller to View”. You’ll learn all the ways in each separate article. from C-Sharpcorner Latest Content https://ift.tt/2pCaFEv
from C Sharp Corner https://csharpcorner.tumblr.com/post/178749818276
0 notes
Text
Passing Data From Controller To View With TempData - Part Four
This article will tell you almost everything you need to know about passing data from Controller to View in ASP.NET MVC using TempData. I am writing this article to tell you the basic to advance foremost concepts about ways to pass data from Controller to View. This article is the fourth one in the series named “Passing Data from Controller to View”. You’ll learn all the ways in each separate article. from C-Sharpcorner Latest Content https://ift.tt/2pCaFEv
0 notes
Text
CodeIgniter - Tutotial
http://www.viralleakszone.com/codeigniter-tutotial/
CodeIgniter - Tutotial
CodeIgniter, Tutotial
CodeIgniter – Tutotial
CodeIgniter Tutorial
CodeIgniter – Overview
CodeIgniter – Installing
CodeIgniter – Application Architecture
CodeIgniter – MVC Framework
CodeIgniter – Basic Concepts
CodeIgniter – Configuration
CodeIgniter – Working with Database
CodeIgniter – Libraries
CodeIgniter – Error Handling
CodeIgniter – File Uploading
CodeIgniter – Sending Email
CodeIgniter – Form Validation
CodeIgniter – Session Management
CodeIgniter – Flashdata
CodeIgniter – Tempdata
CodeIgniter – Cookie Management
CodeIgniter – Common Functions
CodeIgniter – Page Caching
CodeIgniter – Page Redirection
CodeIgniter – Application Profiling
CodeIgniter – Benchmarking
CodeIgniter – Adding JS & CSS
CodeIgniter – Internationalization
CodeIgniter – Security
CodeIgniter – Useful Resources
CodeIgniter Tutorial
CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a
CodeIgniter – Overview
CodeIgniter is an application development framework, which can be used to develop websites, using PH
CodeIgniter – Installing
It is very easy to install CodeIgniter. Just follow the steps given below −Step-1 − Download th
CodeIgniter – Application Architecture
The architecture of CodeIgniter application is shown below.As shown in the figure, whenever a reques
CodeIgniter – MVC Framework
CodeIgniter is based on the Model-View-Controller (MVC) development pattern. MVC is a software
CodeIgniter – Basic Concepts
ControllersA controller is a simple class file. As the name suggests, it controls the whole applicat
CodeIgniter – Configuration
After setting up the site, the next thing that we should do is to configure the site. The applicatio
CodeIgniter – Working with Database
Like any other framework, we need to interact with the database very often and CodeIgniter makes thi
CodeIgniter – Libraries
The essential part of a CodeIgniter framework is its libraries. It provides a rich set of libraries,
CodeIgniter – Error Handling
Many times, while using application, we come across errors. It is very annoying for the users if the
CodeIgniter – File Uploading
Using File Uploading class, we can upload files and we can also, restrict the type and size of the f
CodeIgniter – Sending Email
Sending email in CodeIgniter is much easier. You also configure the preferences regarding email in C
CodeIgniter – Form Validation
Validation is an important process while building web application. It ensures that the data that we
CodeIgniter – Session Management
When building websites, we often need to track user’s activity and state and for this purpose, we ha
CodeIgniter – Flashdata
While building web application, we need to store some data for only one time and after that we want
CodeIgniter – Tempdata
In some situations, where you want to remove data stored in session after some specific time-period,
CodeIgniter – Cookie Management
Cookie is a small piece of data sent from web server to store on client’s computer. CodeIgniter has
CodeIgniter – Common Functions
CodeIgniter library functions and helper functions need to be initialized before they are used but t
CodeIgniter – Page Caching
Caching a page will improve the page load speed. If the page is cached, then it will be stored in it
CodeIgniter – Page Redirection
While building web application, we often need to redirect the user from one page to another page. Co
CodeIgniter – Application Profiling
When building a web application, we are very much concerned about the performance of the website in
CodeIgniter – Benchmarking
Setting Benchmark PointsIf you want to measure the time taken to execute a set of lines or memory us
CodeIgniter – Adding JS & CSS
Adding JavaScript and CSS (Cascading Style Sheet) file in CodeIgniter is very simple. You have to cr
CodeIgniter – Internationalization
The language class in CodeIgniter provides an easy way to support multiple languages for internation
CodeIgniter – Security
XSS PreventionXSS means cross-site scripting. CodeIgniter comes with XSS filtering security. This fi
CodeIgniter – Useful Resources
The following resources contain additional information on CodeIgniter. Please use them to get more i
Discuss CodeIgniter
CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a
Discuss CodeIgniter
0 notes
Text
WebServices Using Swift
// WebServiceClass.swift
// webService
// Created by Bhushan on 24/07/18.
// Copyright © 2018 Bhushan. All rights reserved.
import UIKit
typealias completionService = (_ data: Data, _ response: URLResponse, _ error: Error?) -> Void
class WebServiceClass: NSObject {
override init() {
super.init()
}
func sendGetRequest(_ dictionary: [AnyHashable: Any], withMethod method: String, withCompletion block:@escaping completionService) {
let sessionConfig = URLSessionConfiguration.default
let session = URLSession(configuration: sessionConfig, delegate: nil, delegateQueue: nil)
let request = NSMutableURLRequest(url: URL(string: method)!)
request.httpMethod = "GET"
let dataTask = session.dataTask(with: request as URLRequest) { (data,response,error) in
if error != nil{
print(error!.localizedDescription)
if block != nil {
let tempData : Data = Data()
let tempResponse : URLResponse = URLResponse()
block(tempData, tempResponse, error)
} }
else {
if block != nil {
block(data!, response!, error)
}
}
}
dataTask.resume()
}
func sendPostRequest(_ dictionary: [AnyHashable: Any], withMethod method: String, withCompletion block: @escaping completionService) {
let sessionConfig = URLSessionConfiguration.default
let session = URLSession(configuration: sessionConfig, delegate: nil, delegateQueue: nil)
let request = NSMutableURLRequest(url: URL(string: method)!)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")
let postData: Data? = try? JSONSerialization.data(withJSONObject: dictionary, options: [])
request.httpBody = postData
// request.httpBody = postData
let dataTask = session.dataTask(with: request as URLRequest) { (data,response,error) in
if error != nil{
print(error!.localizedDescription)
if block != nil {
let tempData : Data = Data()
let tempResponse : URLResponse = URLResponse()
block(tempData, tempResponse, error)
}
// return
}
else {
if block != nil {
block(data!, response!, error)
}
}
}
dataTask.resume()
}
***Important Links***
http://images.nuptial.me/ProfilePics/Wedding1/ProfilePicForPartner1.png http://images.nuptial.me/WedsiteImages/Wedsite1/WedsiteImageForWedding1/WedsiteImage11198175568T1530284086.jpg
http://aerialyoga_api.dedicatedresource.net/login email, password , device_type
http://aerialyoga_api.dedicatedresource.net/about-us
***To Download Image***
func downloadImage(url: URL, withImage imageView:UIImageView) {
print("Download Started")
// var actInd: UIActivityIndicatorView = UIActivityIndicatorView()
// showActivityIndicatory(imgView: imageView, and: actInd)
getDataFromUrl(url: url) { (data, response, error) in
guard error == nil else { return }
print(response.suggestedFilename ?? url.lastPathComponent)
print("Download Finished")
DispatchQueue.main.async() { () -> Void in
// actInd.stopAnimating()
imageView.image = UIImage(data: data)
}
}
}
***Hints About Post Method***
func inviteeLogin(){
if isValidated(){
showLoader(OnView: view)
let serviceHandler: ServiceHandler = ServiceHandler()
let postString = "Invitees[INVITEE_EMAIL]=\(txtEmailField.text!)&Invitees[PIN_CODE]=\(txtEnterCode.text!)"
serviceHandler.sendPostRequestWithString(postString, withMethod: "http://rest.nuptial.me/wedsite-couple/login", withCompletion:{(_ data: Data, _ response: URLResponse, _ error: Error?) -> Void in
if error == nil {
do{
let dic = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String : Any]
if ((dic?["status"] as! Int) == 1) {
DispatchQueue.main.async(execute: {() -> Void in
self.dismissLoader()
print(dic!)
let dict = dic!["data"] as! [String:AnyObject]
NPConstants.defaults.set(dict["INVITEE_ID"], forKey: "inviteeId")
NPConstants.defaults.synchronize()
let controller = self.storyboard?.instantiateViewController(withIdentifier: "NPInviteeVC") as! NPInviteeVC
self.navigationController?.pushViewController(controller, animated: true)
})
}
else
{
DispatchQueue.main.async(execute: {() -> Void in
print(dic!)
self.dismissLoader()
})
}
}
catch{
self.dismissLoader()
print("catch block")
print("Error with Json: \(error)")
}
}
else {
DispatchQueue.main.async(execute: {() -> Void in
self.dismissLoader()
})
}
})
}
}
0 notes
Photo
ASP.NET MVC: TempData Keep vs Peek Methods http://www.webcodeexpert.com/2017/01/aspnet-mvc-tempdata-keep-vs-peek-methods.html
In this article you will learn the following:
1) What is TempData? 2) How it is used to persist data for next request? 3) Use of Keep and Peek methods to persist data. 4) Similarities and differences between Keep and Peek methods.
0 notes
Photo
‘中國特色’的開發習慣,非常普遍:💩 應用私有的數據區不寫,偏偏把用戶及其它程序無法理解的數據寫入公共存儲空間。 這些數據並不會隨應用卸載而一同刪除,著實的垃圾數據! /storage/emulated/0/baidu /storage/emulated/0/baidu/tempdata /storage/emulated/0/baidu/tempdata/yoh.dat /storage/emulated/0/baidu/tempdata/yol.dat /storage/emulated/0/baidu/tempdata/yom.dat /storage/emulated/0/baidu/tempdata/grtcf.dat /storage/emulated/0/baidu/tempdata/llg.dat /storage/emulated/0/baidu/tempdata/ls.db /storage/emulated/0/baidu/tempdata/ls.db-journal
0 notes
Photo
(via کاربرد متدهای Keep و Peek در زمان استفاده از TempData در ASP.NET MVC)
0 notes
Text
How To Use TempData In ASP.NET
Tempdata is another beautiful feature in ASP.Net MVC. We use TempData just like we use ViewData. We’ve already discussed a lot about ViewBag and ViewData stuff. TempData is a container in which we maintain the state in consecutive request. TempData is used to store the temporary data. It is using session under the hood. But it is not exactly a session. It automatically clears in application but we need to explicitly clear our session variables. TempData is actually the TempDataDictionary type. source https://www.c-sharpcorner.com/article/how-to-use-tempdata-in-asp-net/ from C Sharp Corner https://ift.tt/2LOVsZu
0 notes
Text
How To Use TempData In ASP.NET
Tempdata is another beautiful feature in ASP.Net MVC. We use TempData just like we use ViewData. We’ve already discussed a lot about ViewBag and ViewData stuff. TempData is a container in which we maintain the state in consecutive request. TempData is used to store the temporary data. It is using session under the hood. But it is not exactly a session. It automatically clears in application but we need to explicitly clear our session variables. TempData is actually the TempDataDictionary type. from C-Sharpcorner Latest Content https://ift.tt/2HVUVmw
from C Sharp Corner https://csharpcorner.tumblr.com/post/174917493211
0 notes