C# - Redirect In FileAttribute's OnActionExecuting Not Properly Working
Feb 3, 2010
I have an action called EditProfile. To secure it I have added a class RequireUserLogin inherited from ActionFilterAttribute. In the OnActionExecuting, when I redirect user to login page, before going to login page, it first execute the EditProfile action code (which i don't expect) and than redirect the user to login page. I want to not come in action code. Currently the only option I have is throw exception. Is there any other options. The code is:
public class RequireUserLogin : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (string.IsNullOrEmpty(userID))
{
filterContext.HttpContext.Response.Redirect("http://localhost/test/login");
}
base.OnActionExecuting(filterContext);
}
The EditProfile action is:
[RequireUserLogin()]
public ActionResult EditProfile()
{
}
View 1 Replies
Similar Messages:
Jun 3, 2010
we are running into an issue with our ASP server. If you try to access a password protected page it does a security check and redirects you if you are not logged in, retaining the URL (ie. Members/MemberLogin.aspx?doc=/PodCast/Default.aspx) The vb script places the "/PodCast/Default.aspx" in a variable and holds it until the login process is complete. Once the user types in their username and password it is suppose to do a Response.Redirect(strRedirectURL) and go to the "/PodCast/Default.aspx" but instead it goes to the default.aspx page for logging in successfully.
The kicker is, I know the code is 100% correct becuase it was working on our previous server, but when we pushed all the data onto this server, everything works BUT that piece.
View 1 Replies
Aug 26, 2010
I am trying to create an Abstract class that looks like the following (note that I coded it right inline here so it may not compile):
[Code]....
I want to (in my edmx design) be able to inherit from EntityBase and have each of those 6 columns be added to the physical database table representing the object that inherits it. So, for example, I have a class called Test that would look like this:
[Code]....
That Test class should have its physical data store mapping based on the other "stuff" plus the properties inherited from EntityBase. Thus, the database table for Test needs to also include those 6 columns from EntityBase. However, I'd like for it to be set up in a way so that they get mapped such that in the edmx design (what is that designer called anyway) when an entity inherits from the EntityBase, I don't need to do any further work to propogate those 6 columns over to the underlying database table. Am I making sense in how I am explaining this? how to accomplish this?
On a side note (and this can be answered separately or not at all) assuming this mapping is in place, NHibernate has a concept called an Interceptor. I'd like to add an "interceptor" to the delete function of any entity that is inherited from EntityBase so that it updates DeletedAt with the current time and DeletedBy with the current user and the same would be true for any updates with UpdatedAt/By. With NHibernate, you can test inside of this interceptor whether or not the object is of a certain type (e.g. object is EntityBase). Any ideas on how to get this with EF 4.0?
View 1 Replies
Feb 21, 2011
I have a login control that is working beautifully on my localhost, but not working on the server. It validates my username & password - and gives me an error if I enter an invalid username/password. However, if I enter the correct username/password, the page refreshes, but does not redirect me to the "ReturnUrl" that I see in the URL. I've seen posts on this, but nothing that I tried worked. I've tried setting the 'MembershipProvider'attribute of the login control. I don't want to set the DestinationUrl...I want it to take what is in the ReturnUrl in the querystring. I don't think it's a web.config issue cuz it works on localhost??
View 3 Replies
Apr 20, 2010
I am using following setting for customError.
< customErrors mode="On" defaultRedirect="GenericErrorPage.aspx" >
< error statusCode="403" redirect="NoAccess.aspx" />
< error statusCode="404" redirect="FileNotFound.aspx" />
< /customErrors>
I have a folder "Admin" having access to administrators role. When someone other than administrators tries to access the pages inside admin folder, it is redirected to login page. My expectation is to display "NoAccess.aspx". Whats wrong with this code? Or is there other meaning to statusCode=403.
View 1 Replies
Feb 16, 2011
I have develoed a vb.net application for my client. I have been using datareport for that. The Data report get the output from the dataset file with the parameter. Now we need to show the value order by. For this i have added the order by in sql query which is generated by .xsd file. But still the output does like,...................
View 1 Replies
Feb 15, 2010
I have added a new route to Global.asax in order for me to create some nice seo friendly URLs for some news items I am displaying
routes.MapRoute(
"News",
// Route name
"{controller}/{action}/{id}/{title}",
// URL with parameters
new { controller =
"News", action =
"Story", id =
"", title =
"" }
// Parameter defaults );
routes.MapRoute{"Default",
// Route name
"{controller}/{action}/{id}",
// URL with parameters
new { controller =
"Home", action =
"Index", id =
"" }
// Parameter defaults );
The problem I have is that when I now hit my home page I am getting [URL] displayed in my URL rather [URL] which is what I used to get. I think the news route is picking up everything. Has anyone any ideas on what constraint I could put on the news route above so that it only ever processes requests from the news route. I was thinking of doing a reg ex on the title and excluding anything with the '-' character in it but I coud not get that to work
View 1 Replies
Apr 18, 2010
I am using accordin menu in my site, placed in Master Page, It has 4 pane, each pane have multiple links. it was working fine previously. But suddenly it is displaying this error message There is no source code available for the current location.
It's is asking for show assembly. When I clicked on that I got a stopage at the stack
0000001a mov eax,dword ptr [ebp-0Ch]
I am really not sure what does it means. Also, there are several links in accordin menu, after clicking on anyone of the link I am not able to click the other link, might be because of the above reason.
View 1 Replies
Jun 8, 2010
I am trying to use the ASP.NET regularexpressionvalidator to apply a password policy that enforces the following policy:
Password should include at least 6 characters, at least one small letter, at least one Capital letter, at least one number, and at least one special character. Here is the expression:
^.(?=.{6,})(?=.d)(?=.[a-z])(?=.[A-Z])(?=.[@#$%^&+=!-_()?]).*$
The strange thing I found is that it works fine except with the following scenario, If I use all the required combination without special character such as Hello123" it finds it as valid password. below is the controls used for testing.
View 3 Replies
Jun 11, 2010
I have developed a ASP.Net Server custom control in C# for 3.5. named "myCheckBoxList" inherited from CheckBoxList web control. Working is very simple. It just works as a two option buttons. I have taken a CheckBoxList which will show two fixed checkboxes always. When I check one checkbox then another will uncheck as vise versa. This control works perfectly only when I have placed only one instance of that control on web page. If I place more than one instance of control then it doesnt works.
I need solution from expert minds from developers as stackoverflow users.
View 2 Replies
Oct 18, 2010
I have created a simple app with a page having a server side form, three fields and a button that submits and performs two operations - 1) adds the form fields to the database table 2) sends an email. Now everything works fine on the web browser on my machine but when I access the app through my mobile, the page does not seem to work. the UI and all are set but the button click functionality doesnt seem to be working and also the label which is set after a successful submit is already visible and showing the "thank you" message. Am i doing something wrong here? I have checked the app on Nokia Smartphone browser, android phone, and iphone simulator.
View 2 Replies
Jan 24, 2011
I have VS 2010. But IDE Not Working Properly like some times breakpoints are not applied, auto complete text is not showing etc.,
How can I get VS 2010 IDE right.
I have done Devenv /ResetSkipPkgs also...and resettes all the settings.
View 1 Replies
Mar 7, 2011
I have to show some functionality similar to accordion that is of jquery so i made a custom function of jquery to produce the effect. there is a grid view in which there are two div's here is the code.
<asp:GridView ID="grdAccordion" runat="server" AutoGenerateColumns="false" Width="200px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<div class="myFirstDiv" onclick="testToggle(this)">
<%#Eval("Name")%>
<div class="mySecondDiv" style="display:none">
<%#Eval("Person_Name")%>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
The second div has style property display none. by default all the div are closed.
than i have made a js function that uses the toggle function to perform the action code.
function testToggle(testDiv) {
debugger
var sntHdnValue = $('#hdnSetFlag').val();
if (sntHdnValue == 1) {
$(testDiv).find('div:first').show().attr('isOpen', 'true');
}
else {
$(testDiv)
.parents('table:first')
.find('div[isOpen=true]').removeAttr('isOpen').toggle('slow');
$(testDiv).find('div:first').show().attr('isOpen', 'true');
}
sntHdnValue++;
$('#hdnSetFlag').val(sntHdnValue);
}
here i have made use of the hidden field that let's me know that it is the initial state every thing is closed i am adding a custom attr isopen for my identification
1)the current situation is this At load everty thing should be closed.
2)than at a time only single div should be open. this is working fine. The problem is if i click on the same div that i clicked to open than it has two custom attr isopen now it breaks the second case. how to solve it.
View 1 Replies
Jan 21, 2011
I am using JQuery Table Sorter...Its working fine for all the fields except the year field in my grid view...Year Field is not sorted properly
This is my code:
$(function()
{
$("table[id$='gvInvoiceDetails']").tablesorter({ headers: { 4 : {sorter :
"currency"}},textExtraction:"complex", widgets: ['zebra']
}).tablesorterPager({container: $("#pager")});
});
View 1 Replies
Dec 3, 2010
dear all, my requiredfieldvalidator is screwing up my ok button in my modalpopup and I dont know why. In otherwords, once I include my requiredfieldvalidator and the user clicks ok in the modalpopup, the ok doesnt get fired. see my code below.
[Code]....
View 6 Replies
Jul 1, 2010
i have written the foolwong code to show/hide the panels but it is not working properly can any one tell why..
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible = true; [code]....
But only for first button it is working properly...
View 6 Replies
Feb 22, 2011
the web application was designed using asp.net 4.0/C# with form authentication .
logout is not working. After deleting web history, cookies, passwords, then also logout is not working.
My code is
[Code]....
View 2 Replies
Jun 3, 2010
my urls look like:
www.example.com/{languagecode}/{controller}/{action}/{id}
where language code is en-us, etc.
From the OnActionExecuting event, how can I get these values?
View 1 Replies
Jan 22, 2011
If all my actions have a model that inherits from BaseViewModel, is it possible to initialize this model from the OnActionExecuting method?
Currently in all my actions I do this:
var model = new SomeModel();
model.User = Users.Get(...);
Now I am loading the user object in OnActionExecuting, so I was hoping I could setup my model from there somehow.
View 1 Replies
Apr 22, 2010
I developed my application form in aspx page its such a huge form(6000 lines), I used update progress there for that updatepanel, But i cant able to see the update progress icon when i rendering the page.
[code]....
View 1 Replies
Nov 10, 2010
i try to use ajax tab container control in my project, but it throws error. its not working properly
View 3 Replies
Apr 15, 2010
I'm working on a simple demo project so that I can learn some things about ASP.NET's AJAX capabilities. My problem is that I can't seem to get an UpdatePanel to work properly with a CheckBox inside of it. Here is the markup I'm using in my .aspx file:
[Code].....
View 1 Replies
Oct 11, 2010
ALTER Proc [dbo].[Usp_CheckUserLogin]
(
@Username varchar(20),
@Password varchar(20)
)
as
begin
Declare @RowCount int
Declare @RowCount1 int
set @RowCount = (select distinct UsrId from UserMast where username=@username COLLATE SQL_Latin1_General_Cp1_CS_AS )
set @RowCount1=(select distinct UsrId from UserMast where [password]=@password COLLATE SQL_Latin1_General_Cp1_CS_AS)
if(@RowCount > '0' and @RowCount1 > '0')
if (@RowCount=@RowCount1)
begin
-- select U.UsrId,U.FirstName,U.LastName,U.Email,U.companyId,U.role,R.RoleName from UserMast U join rolemast R on U.Role=R.RoleId
-- where usrid=@RowCount
select 'success'
end
if(@RowCount > '0' and @RowCount1 = '0')
begin
select 'username exist'
end
if(@RowCount= '0' and @RowCount1 > '0')
begin
select 'password exist'
end
if(@RowCount= '0' and @RowCount1 = '0')
begin
select 'both not exist'
end
--return @RowCount1
end
my procedure not give me result i think my syntax is not correct
View 4 Replies
Mar 23, 2010
I have a website that I am trying to publish and it doesn't seem to be working properly. I get an error saying that a master page does not exist. However, the master page is there, but when I publish the code, it does not get published. Is there some sort of cache or something I am missing here?
View 7 Replies
Feb 5, 2011
Using Visual WebDeveloper 2010 Express and ASP.NET 4.0 don't know whether its relevant but the whole thing is in a ContentPlaceHolder and inside an UpdatePanel. To avoid using the old table tr td model, I have created a simple form like this
<div class="admin-form">
<asp:Label ID="UserNameLabel" runat="server"
CssClass="form-label"
Text="User Name" />
<asp:TextBox ID="UserNameText" runat="server"
Width="200px"/>
<br />
<asp:Label ID="PasswordLabel" runat="server"
CssClass="form-label"
Text="Password" />
<asp:TextBox ID="PasswordText" runat="server"
TextMode="Password"
Width="200px"/>
<br />
<asp:Label ID="ConfirmPasswordLabel" runat="server"
CssClass="form-label"
Text="Confirm Password" />
<asp:TextBox ID="ConfirmPasswordText" runat="server"
TextMode="Password"
Width="200px"/>
<br />
<asp:Label ID="EmailLabel" runat="server"
CssClass="form-label"
Text="Email" />
<asp:TextBox ID="EmailText" runat="server"
Width="200px"/>
<br />
<br />
<br />
<span class="form-label"></span>
<asp:Button ID="CreateUserButton" runat="server"
CssClass="button blue"
Text="Create New User"/>
</div>
And the CSS
.form-label
{
width: 300px !important;
}
This renders incorrectly as I would like to have all textboxes vertically lined after taking 300px. What is wrong? I cannot use HTML Controls like label as I have resx for globalization
View 1 Replies