views:

20

answers:

2

Is there a way to get the Request Object in a Html Helper Method.

I'd like to know if a file exists to replace non existent Files with a default Image. Therefore i need the Request Object and it's Method MapPath(path).

Has anybody an idea.

Thx Thomas

A: 

System.Web.HttpContext.Current.Request

Tuomas Hietanen
Thx it works :-)
Thomas Poth
A: 

I am implementing a custom membership and role providers (by deriving from Oracle providers) where I need to store all the role information in the user's session.

I am implementing these custom providers inside a class library project (different from the website project) and need to access the session in them. The idea is to store the role/membership related information in the session after retrieving them for the first time from the database.

When I try to access the Session using

System.Web.HttpContext.Current.Session

I get this as a null object (Object reference not set to an instance of an object.

Why is the session turning out to be null?

Moiz Tankiwala

related questions