|
Set a boolean field [deleted] for each entity you want to rollback. Instead of actually deleting the records, you can just set deleted=true and then, if you want to rollback, set it to false again.
Of course you need to consider the deleted field in your select queries.
I will never again mention that Dalek Dave was the poster of the One Millionth Lounge Post, nor that it was complete drivel.
How to ask a question
|
|
|
|
|
Hi All,
I have a Web Application called FDP which is in .Net 2.0 and there are other 4 applications which are in classic asp. Now we are planning to convert all these 5 applications in to .Net 4.5. We need to use a common master page for all 5 of them I have already implemented and tested it with static data.
Now the other problem is we have some user controls in FDP we have to use on Master page eventually would be common for all 5 applications going forward. Now the problem is when I reference the ascx file in master page by using the Virtual Path, then as the master page is referenced in other applications as dll, this Virtual Path and ascx file is not available there. And the application is throwing error.
Is there any way to reference ascx file in master page as dll or accessing the ascx file of the master page dll in the other applications. And this ascx file has code to access some database and config values, which have to be coming from those other application.
Is it possible to implement this solution. Please give me some advice or any link which can support me. I am also doing my best for this implementation. Please any type of support if very helpful.
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Could you please give more details?
- What is your first problem? You only described your situation, not what the problem is.
- As for the second, we need to know how you try to reference the user controls and which error is being thrown.
<%@ Register TagPrefix="pre" Namespace="nameofnamespace" Assembly="nameofthedllwithoutextension" %>
So it should include a prefix, these are the letters you'll use to use any control contained in the assembly(the dll)
the namespace is the namespace that contains the usercontrol
the assembly is the name of the dll file(most likely in your debug folder while testing) but without the dll extension added. No path should be required afaik.
|
|
|
|
|
The problem is we want to have only one common master file across the projects. For that I have solved it by using the master page dll concept as given here in this blog. () [^] But the problem is as I am accessing a dll of master page if I want to add a user control to it then its ascx file is not available when we reference its dll.
Then I came up with a solution to convert the user controls also into custom controls so that I can put them on the master page and access them.
Now for that I am getting the following error.
Error 86 Cannot use a leading .. to exit above the top directory. ASPNETCOMPILER 0 0 Core
And I have another doubt, that if I have any images and configuration values used in a customer control code, how should I deal with them? Can you please guide me or help me or send a link to me so that I can implement it in best possible way.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
I'm lacking a lot of details but here is my educated guess:
You're trying to reference the dll in your webpage by using a relative path that goes above your web application root.
You should add the dll as a reference to your project, then refer to the name of the dll. Do not include the path or the extension.
<%@ Register TagPrefix="ctl" Namespace="CustomControlNamespace" Assembly="CustomControl" %>
The attribute Assembly refers to the name of the dll.
As for your doubts about configuration and images, really gonna need to see some of your code to help you out there.
|
|
|
|
|
I have put the image file path in appSettings of the Web config of web application which is consuming the Custom Control as below
<add key="Images" value="~/Images"/> Then I have placed code piece in the code behind of the custom control
ConfigurationSettings.AppSettings["Images"].ToString<pre>();
If we do this we is it going to work?
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
That code will work but that way of retrieving settings from Web.config is outdated/deprecated and may not work in future versions of .net.
This link is the recommended way of doing it, according to Microsoft:
Microsoft Recommendation
|
|
|
|
|
Hi,
Yes that is absolutely correct, we are in process of converting this 2.0 application into 4.5, so the one that I have put was 2.0 code, but your suggestion definitely helped me. Thank you very much.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
But I don't know why but the namespaces and classes from that assembly are not at all coming in the intellisense. When I put those names explicitly they were giving syntax errors.
Please help me in this regards.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
In code-behind pages, you link a prefix to the assembly, which is done in the code I posted in previous post. After that, you place a control on your webpage. It will have a prefix, then the name of your control, and only the name of that control. Giving the full name will indeed give syntax errors.
If you placed
<%@ Register TagPrefix="vg" NameSpace="coolstuff" Assembly="coolstuff" %> on top of your page, you should place
<vg:CoolControl id="testcontrol" runat="server">
in your page where you place your control(s).
If I'm misinterpreting your question, please provide more details.
|
|
|
|
|
I am using OpenXML to generate Excel doc how to I apply styles for specific cell?
Dim CellStyleFormats As New CellStyleFormats
With CellStyleFormats
.?????
End With
mergeCell.Append(CellStyleFormats)
mergeCells.Append(mergeCell)
|
|
|
|
|
Hi,
I have some aspx pages, as we are adding some new applications which are going to use some of the same pages we want to make those common pages as user controls.
I started making the aspx pages into User controls I changed the name of the files to ascx, ascx.cs, removed page attribute and put the control attribute, removed html, body and form tags from aspx file, in code behind I made change to inherit from UserControl class. Everything looks good upto this.
But those previous aspx pages were accessing some user controls, now those controls are displaying error message. Like at uc1:htmlhead and uc1:formheader it is displaying error message as "Unrecognized tag prefix or device filter uc1".
Below are the register and control directives for the user control. For the current User Control I have taken Control directive and for other ones I have taken Register directive. Am I missing any where. Please help me or suggest me or give me a link, any type of help is very helpful. Thanks in advance.
<%@ Register TagPrefix="uc1" TagName="HtmlHead" Src="../Includes/HtmlHead.ascx" %>
<%@ Page Language="c#" CodeBehind="ChangePass.ascx.cs" AutoEventWireup="false" Inherits="DIS.CnpWeb.Core.ChangePass" %>
<%@ Register TagPrefix="uc1" TagName="FormFooter" Src="../Includes/FormFooter.ascx" %>
<%@ Register TagPrefix="uc1" TagName="FormHeader" Src="../Includes/FormHeader.ascx" %>
<uc1:htmlhead id="HtmlHead1" runat="server"></uc1:htmlhead>
<uc1:formheader id="FormHeader1" runat="server"></uc1:formheader>
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Can you provide the top section of you user control?
|
|
|
|
|
Here is the whole form
<%@ Control Language="c#" CodeBehind="~/Rollover.ascx.cs" ClassName="Rollover" AutoEventWireup="false" Inherits="DIS.CnpWeb.Core.Rollover" %>
<%----%>
<asp:Table ID="tblSection0" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell ID="tdpSection0" Text="Rollover"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="3">
<asp:Image runat="server" ID="imgSection0"></asp:Image>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="tblError0" runat="server" Width="100%" CellSpacing="1" GridLines="Both"></asp:Table>
<p></p>
<asp:Table ID="tblError1" runat="server" Width="100%" CellSpacing="1" GridLines="Both"></asp:Table>
<p></p>
<asp:Table ID="tblSection1" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell ID="tdnSourceYear" Text="(1)" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpSourceYear" Text="Source Year:" runat="server"></asp:TableCell>
<asp:TableCell ID="tddSourceYear" Width="20%" Text="200X" HorizontalAlign="Left" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpDataSource" Width="20%" Text="Data Source:" runat="server"></asp:TableCell>
<asp:TableCell ID="tddDataSource" Width="30%" Text="Some Server" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdnTargetYear" Text="(2)" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpTargetYear" Text="Target Year:"></asp:TableCell>
<asp:TableCell ID="tddTargetYear" Text="200Y" HorizontalAlign="Left" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpCatalog" Text="Database Name:" runat="server"></asp:TableCell>
<asp:TableCell ID="tddCatalog" Text="MyDatabase" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdnProgSelect" Text="(3)" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpProgSelect" Text="Programs to Process:"></asp:TableCell>
<asp:TableCell ID="tddProgSelect" ColumnSpan="1" runat="server">
<asp:DropDownList ID="ddlProgSelect" runat="server"></asp:DropDownList>
</asp:TableCell>
<asp:TableCell ID="tddSelectPgm" runat="server" ColumnSpan="2">
<asp:Button ID="btnSelectPgm" runat="server" Text="Select Program"></asp:Button>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tdrNslp" HorizontalAlign="Left" runat="server">
<asp:TableCell ID="tdnNslp" ColumnSpan="2" runat="server"> </asp:TableCell>
<asp:TableCell ID="tddNslp" ColumnSpan="3" runat="server">
<asp:CheckBox ID="chkNslp" Text="NSLP" runat="server"></asp:CheckBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tdrSfsp" HorizontalAlign="Left" runat="server">
<asp:TableCell ID="tdnSfsp" ColumnSpan="2" runat="server"> </asp:TableCell>
<asp:TableCell ID="tddSfsp" ColumnSpan="3" runat="server">
<asp:CheckBox ID="chkSfsp" Text="SFSP" runat="server"></asp:CheckBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tdrCI" HorizontalAlign="Left" runat="server">
<asp:TableCell ID="tdnCI" ColumnSpan="2" runat="server"> </asp:TableCell>
<asp:TableCell ID="tddCI" ColumnSpan="3" runat="server">
<asp:CheckBox ID="chkCI" Text="CI" runat="server"></asp:CheckBox>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<p></p>
<asp:Table ID="tblStats" runat="server" Width="100%" CellSpacing="1" GridLines="None">
<asp:TableRow>
<asp:TableCell ID="tdpStats" Text="Rollover Status" ColumnSpan="6" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="6">
<asp:Image ID="imgStats" runat="server"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow CssClass="ColHeading">
<asp:TableCell ID="tdpTblNme" runat="server" Text="Table Name" Width="25%"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot" runat="server" Text="Source Total" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct" runat="server" Text="Source Inactive" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna" runat="server" Text="Source Active" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot" runat="server" Text="Target Active" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt" runat="server" Text="Batch Results" Width="15%"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat1" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme1" runat="server" Text="Program Year"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt1" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2" runat="server" Text="Sponsor Application"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2a" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2a" runat="server" Text=" Sponsor App A"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2b" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2b" runat="server" Text=" Sponsor App B"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2c" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2c" runat="server" Text=" Sponsor App C"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2d" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2d" runat="server" Text=" Sponsor App D"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat3" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme3" runat="server" Text="Sponsor Location"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt3" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat4" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme4" runat="server" Text="Product Cost"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt4" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat5" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme5" runat="server" Text="Program Enrollment"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt5" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat6" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme6" runat="server" Text="Entity Xref"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt6" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat7" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme7" runat="server" Text="County Region Xref"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt7" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat8" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme8" runat="server" Text="Warehouse Region Xref"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt8" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<p></p>
<asp:Table ID="tblSummary" runat="server" Width="100%" CellSpacing="1" GridLines="None">
<asp:TableRow>
<asp:TableCell ID="tdpSummary" Text="Rollover Summary" ColumnSpan="2" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="2">
<asp:Image ID="imgSummary" runat="server"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchNbr" runat="server" Text="Batch Number:" Width="20%"></asp:TableCell>
<asp:TableCell ID="tddBatchNbr" runat="server" Text="1004"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchCount" runat="server" Text="Records Added:"></asp:TableCell>
<asp:TableCell ID="tddBatchCount" runat="server" Text="12,452"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchStart" runat="server" Text="Start Time:"></asp:TableCell>
<asp:TableCell ID="tddBatchStart" runat="server" Text="10:05:00"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchEnd" runat="server" Text="End Time:"></asp:TableCell>
<asp:TableCell ID="tddBatchEnd" runat="server" Text="10:07:45"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchTime" runat="server" Text="Total Time:"></asp:TableCell>
<asp:TableCell ID="tddBatchTime" runat="server" Text="00:02:45"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchDte" runat="server" Text="End Date:"></asp:TableCell>
<asp:TableCell ID="tddBatchDte" runat="server" Text=""></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="tblViewLog" runat="server" Width="100%" CellSpacing="1" GridLines="None" BorderWidth="2"
BorderStyle="Solid">
<asp:TableRow>
<asp:TableCell ID="tdpViewLog" Text="Rollover Log" ColumnSpan="2" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="2">
<asp:Image ID="imgViewLog" runat="server"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="txtViewLogData" runat="server" Text="Log Data Here"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="tblButton" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell>
<asp:Image runat="server" ID="imgBottom"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center">
<asp:Button runat="server" ID="btnSubmit" Text="Run Rollover"></asp:Button>
<asp:Button runat="server" ID="btnCancel" Text="Cancel"></asp:Button>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<%----%>
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Looking at the ChangePass.ascx, it is a control so the following tag is incorrect:
<%@ Page Language="c#" CodeBehind="ChangePass.ascx.cs" AutoEventWireup="false" Inherits="DIS.CnpWeb.Core.ChangePass" %>
it should be:
<%@ Control Language="c#" AutoEventWireup="false" CodeFile="ChangePass.ascx.cs"
Inherits="DIS.CnpWeb.Core.ChangePass" %>
don't know if this will fix your error but this can be leading up to the issue.
|
|
|
|
|
Hey Guys
i have to create a webpage that has a button and gridview, once the button is pressed it triggers the click button method which searches my computer for files in a specific folder once files are found it displays it in the grid view .
which i have managed to do my problem is im expected to then give the ability that if the user clicks on the file name(which is a hyperlink) in the grid view that it opens on a new page and that the file is embed in that page ready for viewing??
i have tried all i can think off.
ps the files not in a db they in a folder on my pc later will be on a sever in a folder
hope some on can help me
here is what i have so far
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="119px" >
<Columns>
<asp:TemplateField HeaderText="FileName">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Dir","~/Dir={0}")%>' Text='<%# Eval("File") %>' PostBackUrl="/WebForms4.aspx"> </asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="size" HeaderText="size" />
<asp:TemplateField HeaderText="diretory">
<ItemTemplate>
<asp:Button ID="Button2" runat="server" CommandArgument='<%# Eval("Dir","~/WebForms4.aspx/files?Dir={0}") %>' Text='<%# Eval("Dir") %>' PostBackUrl="~/WebForms4.aspx?Dir={0}" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and C# code
protected void Button1_Click(object sender, EventArgs e)
{
DataTable Dt = new DataTable();
Dt.Columns.Add("File", typeof(string));
Dt.Columns.Add("Size", typeof(string));
Dt.Columns.Add("Dir", typeof(string));
foreach (string filename in Directory.GetFiles(@"C:\files"))
{
FileInfo fileinfo = new FileInfo(filename);
Dt.Rows.Add(fileinfo.Name, fileinfo.Length +"KB", fileinfo.FullName);
}
GridView1.DataSource = Dt;
GridView1.DataBind();
}
Thanks in advanced
|
|
|
|
|
please explain me how to insert images to word document created through .net
|
|
|
|
|
|
Hi, I have written a control that inherits from DataBoundControl
[ToolboxData("<{0}:MyClass runat=server></{0}:MyClass>")]
[Designer(typeof(MyClassDesigner))]
[ToolboxItem(true)]
public class MyClass: DataBoundControl
Problem is, when I try to drag it from the toolbox to the page, the mouse cursor changes to an icon that represents it's not allowed(circle with diagonal line through it). How do I make my control support that? The control works just fine if I manually type it in the page.
What am I forgetting? Any ideas?
|
|
|
|
|
Dear all,
When I call 'api/values', it only allows me login as 'full' user details, but if a login as 'trial' user login details, it throws a 401 error. I would like to ask, if I am missing something in the queries in the user class below or the basicAuthn class:
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
AuthenticationHeaderValue authValue = request.Headers.Authorization;
if (authValue == null || authValue.Scheme != BasicAuthResponseHeaderValue)
{
return Unauthorized(request);
}
string[] credentials = Encoding.ASCII.GetString(Convert.FromBase64String(authValue.Parameter)).Split(new[] { ':' });
if (credentials.Length != 2 || string.IsNullOrEmpty(credentials[0]) || string.IsNullOrEmpty(credentials[1]))
{
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(string.Format("access denied")),
};
}
ClaimRole user = repository.trial(credentials[0], credentials[1]);
ClaimRole user2 = repository.unlim(credentials[0], credentials[1]);
if (user == null || user2 == null)
{
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(string.Format("access denied")),
};
}
else
{
IPrincipal principal = new GenericPrincipal(new GenericIdentity(user.Username, BasicAuthResponseHeaderValue), new string[] { user.role });
Thread.CurrentPrincipal = principal;
HttpContext.Current.User = principal;
}
return base.SendAsync(request, cancellationToken);
}
User Class
public ClaimRole trial(string username, string password)
{
var query = (from s in db.subs
join u in db.user on s.sUID equals u.uID
where s.sExpiryDate >= DateTime.Now &&
u.uUsername == username &&
u.uPassword == password
select u).FirstOrDefault();
if (query != null)
{
return new ClaimRole { Username = query.uUsername, Password = query.uPassword, role = "Trial" };
}
else
{
return null;
}
}
public ClaimRole full(string username, string password)
{
var query = (from s in db.subs
join u in db.user on s.sUID equals u.uID
where s.sPID.Value == 163 &&
u.uUsername == username &&
u.uPassword == password
select u).FirstOrDefault();
if (query != null)
{
return new ClaimRole { Username = query.uUsername, Password = query.uPassword, role = "full" };
}
else
{
return null;
}
}
Please advise
many thanks
|
|
|
|
|
I guess the problem is here:
ClaimRole user = repository.trial(credentials[0], credentials[1]);
ClaimRole user2 = repository.unlim(credentials[0], credentials[1]);
if (user == null || user2 == null)
If the user does not have BOTH the trial and unlim priviledges, you send the Access Denied message.
Use && isntead of || .
|
|
|
|
|
Thank you so much for your response and help. I am sorry to inform, that i have tried using the '&&' operator but I am still getting the same 401 error, when logging in using full query user details.
i would like to ask, if their is certain parameter and method, i should be looking into while debugging the code.
I really appreciated your help. please advise.
Many thanks.
|
|
|
|
|
then test those two repository.trail / repository.unlim functions. At least one of them has a bug.
|
|
|
|
|
Thank you for your feedback. i am stuck on little status code issue, regarding this long problem. When I debug the full and trial repository, while login as 'trail' user, 'resp' variable below is highlighted as red with a 404 status code, but on the fiddler testing environment, it displays the url as 401 unauthorized issue.
ClaimRole user = repository.trial(credentials[0], credentials[1]);
ClaimRole user2 = repository.full(credentials[0], credentials[1]);
if (user == null || user2 == null)
{
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(string.Format("access denied")),
};
}
else
{
<br />
resp -- {StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
Hence I am little unclear, which error to look into. if you get time, could you please advice on any material i should look into or concentrate on.
Many thanks for your time and help.
|
|
|
|
|
As of now,Popup in a page asks for password and onclick jquery ajax method calls webmethod, which returns the actual password of the user for validation.
But if a press F12,the password gets viewed as response .
Note:- After buttonclick, page needs to redirect to the same page.
|
|
|
|