|
The message seems to be deleted by the member.
However to change menu item's font to bold, we can do like below
protected void NavigationMenu_MenuItemDataBound(object sender, MenuEventArgs e)
{
if (e.Item.Text == "Home")
{
e.Item.Text = "<b>Home</b>";
}
}
|
|
|
|
|
Hi,
I'm testing the software Jasob 3 to obfuscate my javascript code.
I have a problem for the javascript methods from server component events.
Example :
<asp:Button ID="btn" runat="server" onClientClick="myFunction()"/>
The name "myFunction" is not obfuscated.
So, I have to change the name manually in the code.
I have the same problem for methods launched from code behind in C#.
Example :
ScriptManager.RegisterClientScriptBlock(this.GetType(), "MyScript", "Myfunction()", true);
So, what can I do else ? Is there anyhing that I forgot ?
Generally we obfuscate just before sending the application in production or we continue to develop with the obfuscated code ?
How can I do to change automatically the javascript method and variable names (for server component events and in the code behind) ?
Thank you!
|
|
|
|
|
Do you know how Jasob names the methods? If yes, you can keep a key/value association where key will be your real method name and value will be the obfuscated name. For OnClientClick , you need to create a custom control which is derived from Button class and when it renders OnClientClick , get the obfuscate name for the specified method and write it to response.
Other way is not to write OnClientClick on the markup. Add the obfuscated method name to button from code behind using button.Attributes.Add("OnClick","Your_Obfuscated_JS_MethodName") .
|
|
|
|
|
I have web page that I want to switch the validationExpression for control based on a checkBox.
I'm trying the code in the script portion of the web page.
When I submit the page and evaluate the Validation Control on the Page_Load during Postback the control has the same expression as defined in the .aspx file body, eg
<asp:RegularExpressionValidator ID="EmailRegexValidator" runat="server"
ControlToValidate="Email" ErrorMessage="Invalid Email"
ValidationExpression=".*@.{2,}\..{2,}"> ///// Does not seem to change in postback
</asp:RegularExpressionValidator>
Any ideas on what I need to do to make this work?
<script type="text/javascript" language="javascript">
function InitValidators()
{
// retrieve instance of our checkbox
var checkbox = document.getElementById('<%=enableValidatorsCheckBox.ClientID%>');
// enable/disable all validators on page based on checkbox state
ValidatorsEnabled(checkbox.checked);
}
function ValidatorsEnabled(state)
{
ValidatorEnable(document.getElementById('<%=NameRequiredFieldValidator.ClientID%>'), state);
ValidatorEnable(document.getElementById('<%=EmailRequiredFieldValidator.ClientID%>'), state);
ValidatorEnable(document.getElementById('<%=EmailRegexValidator.ClientID%>'), state);
if (state)
setValidation(".*@.{2,}\..{2,}")
else
setValidation(" [0-9]{3}[*][0-9]{5}[*][0-9]{2}");
var s = document.getElementById("EmailRegexValidator").validationexpression;
}
function setValidation(someVal) {
document.getElementById("EmailRegexValidator").validationexpression = someVal;
}
</script>
|
|
|
|
|
dwolver wrote: document.getElementById("EmailRegexValidator").validationexpression = someVal;
This won't work. ASP.NET processes validator controls on sever side and render HTML and JS to the response. Validator control may render as a span or div and there is no property called validationexpression for DIV or SPAN.
Your best bet would be to use a custom validator. And use the regular expression methods provided in JS.
|
|
|
|
|
I'm sort of in a transitional phase with creating my sql connections. Up until now, I've used a separate data access layer for all of my sql connections, but after checking out several sample website applcations from the http://www.asp.net website, I've noticed things seem to be changing. Now, obviously linqing has come into use for data access. Also dbml files seem to be used. Some are using stored procedures, others are not. So, I'm just confused as to what is the current best practice to be using in .NET 3.5.
Does anyone know of a site or tutorial that shows the most recent up to date 3.5 best practices for creating your sql server connections & querying?
Thanks.
-Goalie35
|
|
|
|
|
Goalie35 wrote: . So, I'm just confused as to what is the current best practice to be using in .NET 3.5.
Best practice would be the one which works best for you. Seriously, there are plenty of methods available and saying which one is best practice would be subjective. I like simple data access classes which returns strongly typed enumerable collections. It is easy to create and you don't have dependencies with any proprietary frameworks.
Goalie35 wrote: Now, obviously linqing has come into use for data access
Are you talking about LINQ to SQL? If yes, I guess MS is concentrating more on it's successor, Entity Framework. I haven't tried Entity Framework, but it's worth to try it.
|
|
|
|
|
Hi all
I want send a page by fax in asp.net but I don’t know how to do it
Plz help me
Thanks
regard
|
|
|
|
|
|
Are you sending something you generate on the server ? Then, ASP.NET is irrelevant. You just need to research fax solutions in general.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Though this question does not directly belong to ASP.NET but i still think it is not much irrelevant either. I need to know and configure a few things like DNS, and IP mapping.
In fact my client has provided us with a dedicated server which is supposed to host the web application we developed for him in ASP.NET. I have uploaded and can access it through Remote Desktop. It has a static IP. He has also bought a domain name for his site. Now we have to do a few things which i describe below:
- Need to configure DNS server on this machine so that the application i have currently uploaded on it, which runs using the ip will use the proper url so that it will be accessed globally with this domain url.
- Need to map the provided static ip to this domain. Though i know there are paid services available which map the ip to the domain, can i set it up myself? Or is there any site available which provides this service for free?
- Need to implement SSL certificate. This is not an issue if i successfully accomplish above two tasks.
Would anybody elaborate the details of how to carry out these things and which authorities/services to call upon if needed (like for getting the domain mapped to our IP etc.).
thanks in advnces.
|
|
|
|
|
Instead of setting up your own DNS server just use a free one. Ive got about 40 domains with everydns.net and ive never had a problem. They are free too.
-Once you register an account there at the bottom left theres a text box to add ur domain. Type it in (like mydomain.com without www).
-Then click on the domain on the left and it allows you to edit mappings in the center
-Near the top theres a current A record and cname record. Delete both.
-Then type mydomain.com in the top box and select A record from the drop down, and put the static IP of ur server in the bottom one. Save
-Then type www.mydomain.com in the top box, choose cname record, then instead of IP put mydomain.com. Save.
-Wait an hour for it to propogate.
- Then finally send an edit ticked for your domain and change Nameservers to
ns1.everydns.net
ns2.everydns.net
ns3.everydns.net
ns4.everydns.net
And ur done
|
|
|
|
|
roguemat!
Thanks for the reply. Though i still prefer to setup my own DNS server, but currently i have got everydns.net. Thanks again.
Now there's one problem. I need to setup mail server to send/receive mails. I have created a virtual SMTP server mail.mydomain.com in IIS. There are a couple of things:
- Where do i create the mail accounts under this server?
- How do i tell everydns.net about this mail server? Remember i have created an MX record
mail.mydomain.com on everydns.net and created mail server with the same name in IIS.
|
|
|
|
|
Im presuming you are using windows server?
In answer to your second point, thats all you need to do. When a mail gets sent to your domain it gets the mx record and thats that. So that side is fine.
To the first one, you will need to just setup emails in the mail server. Ive never used windows mail server but I presume that it will have a link to it(to set it up and create addresses) in that popup window that opens by default when you turn on.
I reckon the best thing to do will be to set a global catcher(one email address that catches all emails if the address its for doesnt exist) and then send an email to meep@yourdomain.com and see if it gets it.
Hope this helps, even just a little.
|
|
|
|
|
Usually, the host provider (saying the virual space provider) will give you a host management tool on his website and of course he will tell you how to set DNS via their tools too.
By using the tool it is very easy to do mapping between a IP and a domain name.
Welcome to www.softwaretree.net!
This website is generated completely by static html pages transforming technology.
You can find many excellent audio/video tools there!
|
|
|
|
|
In fact we are provided with full access to the machine since it is a dedicated server. So there are no services available from the provider.
I have setup DNS on the server taking help from a couple of articles. The A, NS and MX records are there so i think (though am not sure) that DNS is setup fine. The problem is that when i enter the url (not the ip) from the browser from within the server (accessing through remote desktop) the site runs fine but when i give the same url from my own machine which is far from the server it does not recognise the url. I am able though to access the site through the IP. I guess there's something to do to tell the outside world about this DNS server we setup so that URL from any part of the world will get this site.
|
|
|
|
|
Hi all,
Can any one tell me,i want to open a web application in a browser like for example when a xyz site is opened u see a pop-up opens with an ad and there are no file,edit..... menus in it.
Just i want similar to it.Can any one tell me how???
Thanks in advance.
|
|
|
|
|
|
Hi,
I am developing a voting system for a company, everything is going OK but the ability to detect and reject fraud votes.
Currently I am using cookies to determine whether the user has already voted or not, but this is not enough at all becoz a normal user can delete the cookie and vote again and again! A hacker can write a small program to send thousands of web requests that hold no cookies at all, which is of course a disaster!
I though about saving the IP address of each vote and block multiple votes from one IP, but there are many shared machines in cafes, universities, etc. Furthermore, many machines may be behind a firewall which means they will have the same public IP address.
I am sure that there are techniques to solve this problem but I couldn't find any by googling it, any ideas from experts?
ps: I don't want a ready-to-use solution, I want to write it myself coz I want to learn it.
Thanks everybody!
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
Mohammad A Gdeisat wrote: I though about saving the IP address of each vote and block multiple votes from one IP,
I guess, this is what CP is doing. Do your users need to login to cast their vote? If yes, you can store the user id and IP address. And each time check this combination exist. So that multiple users from same IP can vote once.
I guess there is no 100% fraud proof technique is available.
|
|
|
|
|
The problem is that users are not required to login, otherwise I could just store a vote-userID combination.
Any ideas?
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
Mohammad A Gdeisat wrote: Any ideas?
Not much. As I said, it is tough to implement fraud proof online voting system. Best method I can think is, you should keep the IP address validation and forget about multiple users using the same IP.
|
|
|
|
|
Mohammad A Gdeisat wrote: Any ideas?
Yes. You are screwed. If you don't validate the user, you can't validate the user. The end.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Well I think no matter what you are not going to be able to stop very motivated repeat voters. Even major democractic elections using physical voting machines and verified official IDs still run into voter fraud and they've been doing it for years!
However there are probably measures you can take to stem fraud to a minimum. Your first task is to make sure scripts can't vote, only people...so definitely use a CAPTCHA. Also have the user enter an email address with a unique link embedded inside, so they need to check their email and click on a link to make the vote count. This wont stop people with multiple emails voting, but you could also look into doing some simple data mining after the vote takes place to notice any glaring issues...like if there are 10 votes in 10 minutes from the same IP.
Another critical note: whatever this voting system is going to elect, it better not be important! Because if it is, someone motivated enough will probably be able to crack, or at least bias, whatever system you have in place.
Good luck!
|
|
|
|
|
I want to generate a table at run time in a panel.I want 5 columns in each row.
here is code-
Table tbl = new Table();
tbl.Style.Add("text-align", "center");
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
TableCell tc1 = new TableCell();
TableCell tc2 = new TableCell();
TableCell tc3 = new TableCell();
TableCell tc4 = new TableCell();
TableCell tc5 = new TableCell();
tc1.BackColor = Color.WhiteSmoke;
tc2.BackColor = Color.WhiteSmoke;
tc3.BackColor = Color.WhiteSmoke;
tc4.BackColor = Color.WhiteSmoke;
tc5.BackColor = Color.WhiteSmoke;
tc1.Width = 185;
tc2.Width = 185;
tc3.Width = 185;
tc4.Width = 185;
tc5.Width = 185;
//tc1.BorderWidth = 1;
//tc2.BorderWidth = 1;
//tc3.BorderWidth = 1;
//tc4.BorderWidth = 1;
//tc5.BorderWidth = 1;
tc1.Style.Add("text-align","center");
tc2.Style.Add("text-align","center");
tc3.Style.Add("text-align","center");
tc4.Style.Add("text-align","center");
tc5.Style.Add("text-align","center");
tr.Width = 926;
tr.Height = 23;
tr.BorderWidth = 1;
tr.Controls.Add(tc1);
tr.Controls.Add(tc2);
tr.Controls.Add(tc3);
tr.Controls.Add(tc4);
tr.Controls.Add(tc5);
//tc.Width = 110;
//tc.Height = 22;
//tc.Font.Size = 40;
tc1.Text = "Niraj jain";
//tr.Controls.Add(tc);
tbl.Controls.Add(tr);
}
Panel5.Controls.Add(tbl);
but this table is not generating inside the panel.It is below the panel.
plz help....
|
|
|
|