Restrict Access to Aspx Page

J

Jacques Oberto

Hi All,

One of the aspx pages in my application is a run-time
image generator and is called using URL by other pages
in my app.
I would like to restrict direct acces to the image generator
page from external (different domains) applications/webusers.
How can I achieve that?
Thanks,

Jacques
 
J

Jacques Oberto

One of the aspx pages in my application is a run-time
image generator and is called using URL by other pages
in my app.
I would like to restrict direct acces to the image generator
page from external (different domains) applications/webusers.
How can I achieve that?

I think I found a solution by defining a Session variable in
the code behind of the authorized pages and checking that
variable in the restricted aspx page.
 
G

Guest

Hi All,

One of the aspx pages in my application is a run-time
image generator and is called using URL by other pages
in my app.
I would like to restrict direct acces to the image generator
page from external (different domains) applications/webusers.
How can I achieve that?
Thanks,

Jacques

Check HttpRequest parameters as in the following code

if (context.Request.UrlReferrer == null
|| context.Request.UrlReferrer.Host.Length == 0
|| context.Request.UrlReferrer.Host.CompareTo
(context.Request.Url.Host.ToString()) == 0)
{

// show image

}
 
J

Jacques Oberto

Check HttpRequest parameters as in the following code

if (context.Request.UrlReferrer == null
|| context.Request.UrlReferrer.Host.Length == 0
|| context.Request.UrlReferrer.Host.CompareTo
(context.Request.Url.Host.ToString()) == 0)
{

// show image

}


Thanks Alexey, very useful. That should also allow to define
a group of authorized external users.

Jacques
 
G

Guest

Check HttpRequest parameters as in the following code

if (context.Request.UrlReferrer == null
|| context.Request.UrlReferrer.Host.Length == 0
|| context.Request.UrlReferrer.Host.CompareTo
(context.Request.Url.Host.ToString()) == 0)
{

// show image

}

Thanks Alexey, very useful. That should also allow to define
a group of authorized external users.

Jacques

Then you can simply add context.Request.UrlReferrer.Host.CompareTo
("domain.com") to check if requests comes from an authorized domain.
 
C

Cubaman

Hi All,

One of the aspx pages in my application is a run-time
image generator and is called using URL by other pages
in my app.
I would like to restrict direct acces to the image generator
page from external (different domains) applications/webusers.
How can I achieve that?
Thanks,

Jacques

You can create groups, and just configure acces in your web.config.
http://support.microsoft.com/kb/815151
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top