.net - Can't Get FormsAuthentication To Properly Work With WCF?
Apr 15, 2010
I have both the wcf and asp.net project together in the same project. (I'm running on Azure, so this is more convenient).I have this set in the web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
y wcf service is decorated with:
[code]...
I have a Default(contains the sign-out button) and Login page, once the user is not authenticated, it will always redirect the user to login page.
So the scenario is when the user hit the sign-out button it will redirect him to the login page which is good. My problem is, when the user hits theprevious or back button from the login page,it will still read the authorization cookies and redirect him to the default page. which should not be the case. the user should be redirected to login page when authentication is invalid.
I've read some solutions on the net, but still it doesn't work for me. below are the codes I've used for my sign-out function
[Code]....
By the way, when the user is authenticated, the previous or back button is available/enable for the user.
I'm managing a rather large project, written in asp.net webforms + mvc3, with a large user base, and a pretty high daily visitor count. Basically, there are a lot of requests at any given moment.
One of my controllers in MVC that handles / resizes images on the fly has the following attribute applied to it:
[SessionState(SessionStateBehavior.Disabled)]
Now, if an action in the controller tries to access the session - it obviously throws an exception - so we're good so far. The problem is: if I go to the IIS Worker Processes window (Win Server 2008 R2, IIS 7.5), and check the current requests for this site, I can sometimes see the requests to an action in this controller. Their current state is locked in State: RequestAcquireState, Module Name: Session. Sometimes these locks go over a second or two in this state.
Wasn't the whole point of the attribute in the first place to make the requests to the controller ignore the state, and not waste time (and possibly being locked) trying to acquire the state? If this is so - am I doing something wrong here, or does the problem lie elsewhere?
i am still new to using session state, i want to convert page name into and integer according to a database table a function then compares "X" and "Y" to check if a user have the right to view this page i know this is not the best way of managing website security, but it is like "training on how to use the session" what have i done wrong
Partial Class advancedsearch Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Label1.Text = Session("username").ToString Label3.Text = Session("role").ToString Label4.Text = System.IO.Path.GetFileName(Request.Url.ToString()) Catch ex As Exception Response.Redirect("login.aspx") End Try If Label1.Text = "" Then Response.Redirect("login.aspx") End If Dim x As Integer = Int32.Parse(Label3.Text) Dim y As Integer = Int32.Parse(DropDownList1.SelectedItem.ToString) If x < y Then Response.Redirect("login.aspx") End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Redirect("default.aspx") End Sub End Class
now i use the dataview to sort the seq of datatable and bind to repeater, it can only display the seq correctly.but i found that it is not the actual database seq, when i remove the row from the datatable, it is not remove the record that i see from the UI.do i need to sort the seq to the actual datatable not the dataview.now i use the seq (int) in datatable to sort the datatable as belows:
cmd ="select [title] from products where sku='% "3.5 caddy" %'"
this statement wont return anyfin where there is products with titles startin with 3.5 or ending with caddy or containing 3.5 caddy but just not together for example there is this title "3.5" IDE to USB 2.0 Aluminum External Silver HDD Enclosure Caddy" and that search of 3.5 caddy wont pick this item up as 3.5 is at the start and caddy is at the end.
I'm new here and I need some help to use the AutoComplete Extender. I just have a default.aspx with a textbox extended with an AutoComplete. My Web Service calls a SQL Data Base thru Linq and return some account names.When I execute the WEB SERVICE and manually insert the parameters, it works! But when I execute the default.aspx, nothing happens. I really apreciate your help! See the CODES listed below:
See the Web Service code below:
[Code]....
Now, the code on DEFAULT.ASPX
[Code]....
I tried put the files in a remote SERVER, and I got the following error (in LOCALHOST I don't see that error):
Configuration Error Server Error in '/PC' Application. Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
[Code]....
Line 8: <configuration> Line 9: <system.web> Line 10: <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" /> Line 11: </system.web> Line 12: Source File: e:homeuysoftWebweb.config Line: 10 Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.4028
I have written a bunch of T-sql code to my accessdatasource selectcommand. But I am having problem with where statement ! here is my code;
SELECT OWGBP, RTGBP, OWEUR, RTEUR, OWYTL, RTYTL, (SELECT Resort FROM Resort RF WHERE (View = True) AND (RF.ResID = TypePrices.ResID)) As Resortİsmi, (SELECT Destination + ' - ' + CodeOfDest FROM Destination TD WHERE (View = True) AND (TD.DestID = @DestID)) As DestIsmi, (SELECT TypeOFTrf FROM TRFTypes WHERE (TRFTypes.TRFTypeID = TypePrices.TypeOfTRF)) As TrasferTürü, @QADT As ADTSayi, @QCHD As CHDSayi, ([CHDPerCent]/100) As PerCHDCent, (ADTSayi ++ CHDSayi) As Deger, ResID FROM TypePrices WHERE ([View] = True) And (ResID = @QRes) AND (Deger >= [MinReq]) AND (Deger <= [MaxCap])
And here is my select parameters;
[Code]....
It is a bit long ! I am having problem on last two where declaration. here ;
(Deger >= [MinReq]) AND (Deger <= [MaxCap])
those MinReq and MaxCap columns are int32 columns. But when I run the page it doesnt work properly ! It display the valuse it shouldn't be ! weird thing is, when I display this 'deger', I get the value properly. with this;
I designed a simple site with some css and jquery. All the css is in the header using and the javascript files are in a folder called Scripts and referenced in my site like below. Everything is beautiful locally, but on the server some objects such as a couple of my divs are out of their original positions, and my dropdown menus that use jquery don't work properly but they do work somewhat (like they slide down or fade). I have made identical folder structure in root on the web server. I am using .NET 3.5 and the server does support it.
Do you guys think it can be a path issue for my scripts? What could cause the css to move divs out of position? Does css or jquery behave differently on different servers?
why my upload control will not work properly when placed inside an ajax tab control? If I place it outside the tab control everything works great.Here is what I'm trying.
I used Basic Date Picker when i deployed the site and run on the IIS server then it is take the wrong date.I need the date formate as "dd/MM/yyyy" therefor i made changes in region setting but it can't work properly
The thing is that, the first if statement works fine and the 'javascript' shows an alert and close the window, but in the second if statement the javascript shows the message but doesn't close the window.
I created a self-signed certificate for testing in IIS7 (win 7 64 bit environment ). I attached the cert to the bindings, etc and everything was fine. But when I crank up the site I get the generic error: There is a problem with this website's security certificate. Continue to this website (not recommended). What should I be looking at to fix this
I am having issue with cache-control. I have one IIS website with multiple host headers. When you browse site number 1 then cache will be set for this site, when you open browser again and go to 2nd site you will see content from first site. How can I determine cache content based on the site user visits? Everything working fine when you have 1 site and host header related to SAME site.
//Set Cacheability if (!Context.User.Identity.IsAuthenticated && _activeNode.CacheDuration > 0) { var eTag = GetETag(_activeNode); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);
I have a ListBox1 on the Form that I read in the same Directories: "GetS" as in the code below.
Now I select the first index wich is 0 in the listBox with the mouse and press Button1.
What the code below does is to find that specific folder that also contains a .BMP file and a file: File1.txt
So I will first delete the .bmp file and the File1.txt and at last the directory.
My problem is as follows. When I press Button1 the First time, nothing at all was deleted but the second time I press the Button1, the .BMP file and the File1.txt were delete fine.
But the code breaks at this line and says that the directory isn´t empty. But the directory is empty as I can see when open it manually.
So initially my problem is why the .BMP, File1.txt and the directory aren´t deleted at the first press of Button1 ? (ListBox1 has AutoPostBack set to TRUE and everything is put inside an updatepanel)
I have a Datagrid one of the colums is a checkbox and when it is selected I' m supposed to update that row. I have a button to update this outside the Datagrid. It seems to work well for the first two rows but after that meaning starting 3 to any it just doesnt update no errors but doesnt update. When I look into the id it seems to be empty.
Private Sub btnInactivateAllSelected_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInactivateAllSelected.Click ' 'Function declarations Dim currentMethod As String = MethodBase.GetCurrentMethod.Name 'Object declarations 'Variable declarations Dim ruleID As Guid = Nothing Dim oRule As PSXSTL.Digecenter.Rule = Nothing Dim changetext As String = Nothing 'Start Try...Catch statement _moduleName = "btnInactivateAllSelected_Click" Try For Each item As DataGridItem In GroupDataGrid.Items If CType(item.FindControl("chkApprovalCheck"), CheckBox).Checked = True Then ruleID = GroupDataGrid.DataKeys(CInt(item.ItemIndex)) oRule = New PSXSTL.Digecenter.Rule(DirectCast(Session("CustomerID"), Guid), ruleID) If oRule.Complete Then oRule.RuleStatus = False oRule.ActiveDate = Now.ToString changetext = "On " + Now + " " + Session("FirstName") + " " + Session("LastName") + " deactivated the Rule." If Not oRule.ProofReviewed Then changetext = changetext & " PDF not viewed" End If LogEditHistoryItem(changetext, ruleID) ' Call ' added 10/19/2004 by Rob MacMorran LogBulkOrderHistory(oRule) oRule.Update() End If oRule.Dispose() End If Next ' Server.Transfer("customer_clientrules_results.aspx") Catch ExceptionObject As Exception 'Write the exception out to the event log. EventLogHelper.LogException(ExceptionObject, _moduleName, "Error occurred in " & _moduleName & "/" & currentMethod & ControlChars.CrLf & ExceptionObject.StackTrace, EventLogEntryType.Error, 55555) Finally 'Cleanup 'Object disposal If Not oRule Is Nothing Then oRule.Dispose() oRule = Nothing End If 'Variable disposal ruleID = Nothing changetext = Nothing 'Function variable disposal currentMethod = Nothing End Try Server.Transfer("customer_clientrules_results.aspx") End Sub
I am drawing a grid using HTML and each tr element has it's own id. I want to be able to remove a tr on a button click, but not have to redraw the whole grid to show that the row has been deleted. I can do this using .hide(), but the problem is that I need to call a function to stripe my rows after, and since the row is still considered there, the striping doesn't work properly.
I am having a little problem with AJAX htmleditor, it works fine when testing on localhost, but after deploying it on server it wont work properly.
I have 3 different txt source for the htmleditor, and sometimes the texteditor just gets blank and even the toolbar of the editr disappear and after that doesn't matter which source i select the editor stays blank unless i reload the page.
Code:
'======================================= LOAD xxxxxDATA =====================================         'Open a file for reading         FILENAME = Server.MapPath("~adminexxxxxxexxxxxTemp1.txt")          'Get a StreamReader class that can be used to read the file          objStreamReader = File.OpenText(FILENAME)          'Now, read the entire file into a string    Code].....