Click here to Skip to main content
15,915,600 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Problem with JavaScript Pin
phani2548516-Sep-09 15:33
phani2548516-Sep-09 15:33 
AnswerRe: Problem with JavaScript Pin
sashidhar16-Sep-09 21:16
sashidhar16-Sep-09 21:16 
AnswerRe: Problem with JavaScript Pin
Muhammad Mazhar17-Sep-09 9:27
Muhammad Mazhar17-Sep-09 9:27 
QuestionProblem with Ajax call from Infragistics ultrawebgrid Pin
sskala16-Sep-09 6:27
sskala16-Sep-09 6:27 
Questionasp:boundcolumn dataformatstring - How do you suppress the trailing zero Pin
Steve van Niman16-Sep-09 6:05
Steve van Niman16-Sep-09 6:05 
QuestionAjaxModalPopup clicking OK button ,should reatin focus on textbox Pin
yadlaprasad16-Sep-09 4:15
yadlaprasad16-Sep-09 4:15 
AnswerRe: AjaxModalPopup clicking OK button ,should reatin focus on textbox Pin
Not Active16-Sep-09 5:27
mentorNot Active16-Sep-09 5:27 
AnswerRe: AjaxModalPopup clicking OK button ,should reatin focus on textbox Pin
Muhammad Mazhar17-Sep-09 9:30
Muhammad Mazhar17-Sep-09 9:30 
QuestionRequiredFieldValidator doesn't work Pin
Jan R Hansen16-Sep-09 4:11
Jan R Hansen16-Sep-09 4:11 
AnswerRe: RequiredFieldValidator doesn't work Pin
Not Active16-Sep-09 5:24
mentorNot Active16-Sep-09 5:24 
QuestionFingerprint biometrics integration into ASP.Net application Pin
Joseph Cheriaux MPORANYI16-Sep-09 3:53
Joseph Cheriaux MPORANYI16-Sep-09 3:53 
AnswerRe: Fingerprint biometrics integration into ASP.Net application Pin
Manas Bhardwaj16-Sep-09 4:13
professionalManas Bhardwaj16-Sep-09 4:13 
AnswerRe: Fingerprint biometrics integration into ASP.Net application Pin
Abhishek Sur16-Sep-09 9:33
professionalAbhishek Sur16-Sep-09 9:33 
QuestionWeb Site Administration Tool How to change the Password length ASP.NET 3.5 Pin
BoySetsFire16-Sep-09 2:55
BoySetsFire16-Sep-09 2:55 
AnswerRe: Web Site Administration Tool How to change the Password length ASP.NET 3.5 Pin
sashidhar16-Sep-09 21:23
sashidhar16-Sep-09 21:23 
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 

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.