How to restrict specific image in application using Global.aspx

Posted by Murugavelmsc under Interview Questions on 2/11/2013 | Points: 10 | Views : 839 | Status : [Member] | Replies : 2
How to restrict specific image in application using Global.aspx

Regards,
Murugavel S
murugavel.sadagopan@gmail.com
http://murugavelmsc.blogspot.in/



Responses

Posted by: Devi0074u on: 3/12/2013 [Member] Starter | Points: 25

Up
0
Down
You can create a HTTPHandler for solving this issue.

So while registering the handler in web.config, in the path give the file's name which you want the handler should handle.

In the Handler's ProcessRequest event return string saying "This file can not be shown".

This is what you wanted, or you wanted something else?

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/12/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
try this

void Application_Start(object sender, EventArgs e)
{
// Put Here Your Image Restrict Code

}

void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown

}

void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs

}

void Session_Start(object sender, EventArgs e)
{
// // Put Here Your Image Restrict Code

}

Mark as Answer if its helpful to you

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response