Click here to Skip to main content
15,880,608 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Web Site Administration Tool How to change the Password length ASP.NET 3.5 Pin
BoySetsFire17-Sep-09 1:43
BoySetsFire17-Sep-09 1:43 
Questionuse windows usercontrol in web application Pin
ramki.pindi16-Sep-09 2:48
ramki.pindi16-Sep-09 2:48 
AnswerRe: use windows usercontrol in web application Pin
Abhishek Sur16-Sep-09 9:26
professionalAbhishek Sur16-Sep-09 9:26 
GeneralRe: use windows usercontrol in web application Pin
ramki.pindi16-Sep-09 18:52
ramki.pindi16-Sep-09 18:52 
GeneralRe: use windows usercontrol in web application Pin
Muhammad Mazhar17-Sep-09 9:32
Muhammad Mazhar17-Sep-09 9:32 
GeneralRe: use windows usercontrol in web application Pin
ramki.pindi17-Sep-09 18:50
ramki.pindi17-Sep-09 18:50 
QuestionRestrict users to access the help file, download js files Pin
Rijz16-Sep-09 2:45
Rijz16-Sep-09 2:45 
AnswerRe: Restrict users to access the help file, download js files Pin
Abhishek Sur16-Sep-09 9:21
professionalAbhishek Sur16-Sep-09 9:21 
Well.. .Actually browser makes separate http request for each individual external files.


Rijz wrote:
Now these HTML files can be accessed by the users even if they are not logged into the application. How can I restrict this?



To make access to the html files.. I would suggest to use separate HttpHandler which will authenticate your request againist some session id, if session is created already or will do it using uid and password.


Rijz wrote:
Similarly, how can I restrict users to download java script files which is in my application root directory by directly typing the URL in the browser.



In case of Javascript as a separate request is made from the browser, it would not be a good idea to restrict the download of the file. Some browser requests javascript after document is fully loaded, but there are others which actually starts download of the file as soon as it parses the Javascript tag. So you cant trap the behaviour of the browser.

Rather, I would suggest you to edit your javascript and place your sessionid within the url. Place your sessionid in a sesssion variable or in database. Create a separate HttpHandler for Js file which will check if the sessionid(might be your custom GUID which you generate during the login) passed with the querystring is valid for the current user. Allow download of the javascript only when url is valid.

say in your browser you place script tag like this

<script type="text/javascript" src="yourjavascript.js?sessionId=<%=this.Session.SessionId%>

Now from ProcessRequest of IHttpHandler, check

string qry = context.Request.QueryString["sessionId"] as string;
if(!context.Session.SessionId.equals(qry))
{
    context.Response.clear();
    context.Response.close();
}


Also remember to implement your class from RequiresSessionState, otherwise session will not be available in the
HttpHandler
.

Hope you got the idea. Rose | [Rose] Rose | [Rose]

Abhishek Sur

My Latest Articles
Create CLR objects in SQL Server 2005
C# Uncommon Keywords
Read/Write Excel using OleDB

Don't forget to click "Good Answer" if you like to.

QuestionAjax AutoComplete Extender(urgent) Pin
Devkranth Kishore Vanja16-Sep-09 1:57
Devkranth Kishore Vanja16-Sep-09 1:57 
AnswerRe: Ajax AutoComplete Extender(urgent) Pin
Arun Jacob16-Sep-09 1:59
Arun Jacob16-Sep-09 1:59 
GeneralRe: Ajax AutoComplete Extender(urgent) Pin
J4amieC16-Sep-09 2:19
J4amieC16-Sep-09 2:19 
AnswerRe: Ajax AutoComplete Extender(urgent) Pin
Arun Jacob16-Sep-09 2:31
Arun Jacob16-Sep-09 2:31 
GeneralRe: Ajax AutoComplete Extender(urgent) Pin
J4amieC16-Sep-09 2:35
J4amieC16-Sep-09 2:35 
GeneralRe: Ajax AutoComplete Extender(urgent) Pin
Arun Jacob16-Sep-09 2:41
Arun Jacob16-Sep-09 2:41 
AnswerRe: Ajax AutoComplete Extender(urgent) Pin
J4amieC16-Sep-09 2:37
J4amieC16-Sep-09 2:37 
QuestionDynamic Item tmpate inside gridview Pin
sekannak16-Sep-09 1:28
sekannak16-Sep-09 1:28 
AnswerRe: Dynamic Item tmpate inside gridview Pin
Christian Graus16-Sep-09 1:37
protectorChristian Graus16-Sep-09 1:37 
AnswerRe: Dynamic Item tmpate inside gridview Pin
Arun Jacob16-Sep-09 1:54
Arun Jacob16-Sep-09 1:54 
Questionajax controls not working fine..,when evets not fire for some time..., Pin
Member 387988116-Sep-09 0:52
Member 387988116-Sep-09 0:52 
AnswerRe: ajax controls not working fine..,when evets not fire for some time..., Pin
Christian Graus16-Sep-09 1:36
protectorChristian Graus16-Sep-09 1:36 
AnswerRe: ajax controls not working fine..,when evets not fire for some time..., Pin
Shalini_U16-Sep-09 3:11
Shalini_U16-Sep-09 3:11 
QuestionDatabinding Pin
Member 448708316-Sep-09 0:23
Member 448708316-Sep-09 0:23 
AnswerRe: Databinding Pin
Christian Graus16-Sep-09 1:35
protectorChristian Graus16-Sep-09 1:35 
AnswerRe: Databinding Pin
Muhammad Mazhar17-Sep-09 9:35
Muhammad Mazhar17-Sep-09 9:35 
QuestionAccess Denied in CreateDirectory with UNC Path Pin
Stephan Pilz15-Sep-09 23:49
Stephan Pilz15-Sep-09 23:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.