asp.net - restrict access to the users -
asp.net - restrict access to the users -
i nave allow users of intranet load html pages. users can load html pages start username, example:
user: 972547j pages: 972537j*****.html
i used asp.net , vb.net, created gridview linkbutton of pages 972537j****.html
(for user)
that pages confidentially, don't want users alter manually link , show html pages of other users.
can deny users not open html pages of others? web config setting or iis7 config? html pages not editable
the first step setup iis handle .html
files using asp.net
and sec step utilize global.asax
check file names user login if allowed view them.
here simple code start, belong global.asax
:
protected void application_beginrequest(object sender, eventargs e) { // may need httpapplication app = (httpapplication)sender; // start check if html file string cthefile = httpcontext.current.request.path; string sextentionofthisfile = system.io.path.getextension(cthefile); if (sextentionofthisfile.equals(".html", stringcomparison.invariantcultureignorecase)) { // check if user logged in if( httpcontext.current.user == null || httpcontext.current.user.identity == null || !httpcontext.current.user.identity.isauthenticated) ) { // redirect him } else { // create rest test here // httpcontext.current.user.identity } } }
reference handler: using asp.net routing serve static files asp.net mvc routing - add together .html extension routes http://technet.microsoft.com/en-us/library/cc770990(v=ws.10).aspx
asp.net vb.net
Comments
Post a Comment