Asked  9 Months ago    Answers:  5   Viewed   17 times

i have an application which as desired feature, users would like to be able to take a screenshot. while i know this can be simulated, it would be really great to have a way to take a url (or the current rendered page), and turn it into an image which can be stored on the server.

is this crazy? is there a way to do it? if so, any references?



i can tell you right now that there is no way to do it from inside the browser, nor should there be. imagine that your page embeds gmail in an iframe. you could then steal a screenshot of the person's gmail inbox!

this could be made safe by having the browser "black out" all iframes and embeds that would violate cross-domain restrictions.

you could certainly write an extension to do this, but be aware of the security considerations outlined above.

update: you can use a canvas utility function to get a screenshot of a page on the same origin as your code. there's even a lib to allow you to do this:

you can find other possible answers here: using html5/canvas/javascript to take screenshots

Thursday, October 14, 2021

in android 2.2 you could do the following.

create an xml drawable such as /res/drawable/textlines.xml and assign this as a textview's background property.

android:text="my text with lines above and below"


<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="" >
            <stroke android:width="1dp" android:color="#ff000000" />
            <solid android:color="#ffdddddd" />


   <item android:top="1dp" android:bottom="1dp"> 
            <stroke android:width="1dp" android:color="#ffdddddd" />
            <solid android:color="#00000000" />


the down side to this is that you have to specify an opaque background colour, as transparencies won't work. (at least i thought they did but i was mistaken). in the above example you can see that the solid colour of the first shape #ffdddddd is copied in the 2nd shapes stroke colour.

Tuesday, June 1, 2021

perhaps using the google gson library you can deserialise the array to a typed collection of objects, and then using collections perform a sort.

look at 6th line in on the following link.. looks a bit messy but might be quickest way..

Saturday, August 7, 2021

you can use attributes to implement a feature in an aspect-oriented way. action methods that you want to surround with your functionality then only need to be decorated with your attribute:

public actionresult index()
    // doing something here ...
    return view();

you can either decorate a single action method with an attribute, an entire controller, or even apply the attribute globally through mvc's globalfiltercollection.

here's how you'd declare your attribute:

public class customloggerattribute : actionfilterattribute
    public override void onactionexecuted(actionexecutedcontext filtercontext)

        // here goes your logic

    // ...

the actionfilterattribute class allows you to override a couple of methods so you can hook into mvc's action execution pipeline:

  • onactionexecuting
  • onactionexecuted
  • onresultexecuting
  • onresultexecuted

you can access request variables through the parameters (like actionexecutedcontext) that are passed to the above methods.

Friday, September 10, 2021

same issue was resolved when mvcrazorcompileonpublish was added to .csproj file.

give it a try.

Saturday, November 6, 2021
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :